I'll submit a patch, I just wasn't sure if patches to branches were
submitted differently than patches to the trunk.. and I'll start using
Pastie :)

The gist of my patch is this:
-adds an EventCache class that provides the observe/stopObserving
-the EventCache methods handle creating/removing Observer instances
and storing these instances of Observer in a local cache
-Event is extended by EventCache so Event.observe/stopObserving work
as before
-A method to dispose of all EventCache instances will do global
cleanup on IE
-A few other changes not mentioned here for brevity

The net effect is that you can create multiple EventCache instances
and dispose of all event handlers in a particular cache with one call:
var events = new EventCache();
events.dispose(); //cleans up all events added to this cache

-The dispose method has less overhead than separate stopObserving
-Give each widget it's own cache and the following code:
  this.someListener = this.someFunction.bind(this);
 can be replaced with:
  //no separate stopObserving call is necessary
-Now, adding other events to a widget that has it's own cache is
*much* easier:
The above observer will be disposed of properly when the widget is
disposed of.

Note, this functionality cannot be replicated with the 6194 code by
calling Event.stopObserving(this.element). Here's why:
-There are likely more than one elements that have observers needing
disposal by a widget
-The element may have observers that shouldn't be disposed of (created
by other widgets on the same element for example)

Lastly, why don't I add this functionality separately instead of
trying to get Prototype patched? It is because the Event class does
it's own caching in such a way that cannot be extended, so such
efforts would be duplicating the caching and over-complicating cleanup

Let me know if you have any other questions or thoughts on this. I
will try to get a patch submitted on Trac shortly, but to see what the
new event.js file would pretty much look like you can go here:

Thanks for the consideration,

You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to