I recently discovered that Prototype (and by extension, Scriptaculous) has a useful workaround for this problem using it’s bind() function. This function allows you to bind to a function an object to use as the scope of operation. Meaning, if you call it within an object and add
bind(this) to your function call, everything within the function is treated as part of the calling object, not the function.
And thus, your event handlers are actually made relevant to what you’re calling, instead of being arbitrary and orphaned chunks of code.