Wow, I didn't realize how much more complex this was. Thanks for the advice.
On Feb 9, 3:30 am, kangax <[EMAIL PROTECTED]> wrote: > I've been working on a delegation plugin with syntax like this: > > Event.register(selector, eventName, handler); > > It supports multiple selectors (separated via comma) and an interface > to unregister events. > > The implementation is NOT as simple as it seems to be. Just to name a > few gotchas you stumble upon: > > 1) When event is caught by a top level element (document in my case), > its target property points to a down-most clicked element (which is a > standard bubble-mode behavior) - not only target but ALL the ancestors > should be matched against as well. > 2) Using selector matching is fine with events like "click" but is a > real blocker (speed-wise) when observing mouseover/mouseout (I had to > cache instantiated selectors to make it all faster). > 3) All this custom mess needs to be carefully cleaned up on page > unload (I'm talking about IE's wonderful GC). > > My point is that this is NOT something to be in a core (or at least > any time soon), but rather a good candidate for a standalone > extension. > I am planning to release this plugin, but wanted to write a nice > article accompanying it (since many people have never even heard of > event delegation) > > Best, > kangax --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to firstname.lastname@example.org To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---