I'm using event delegation a lot recently. I even opened a ticket for
it - 
http://prototype.lighthouseapp.com/projects/8886/tickets/435-eventdelegate-and-elementmethodsdelegate

The problem I see in your approach, is that Event.stopObserving won't
clear callback from cache, but if your Event.register becomes
Event.observe (i.e. in core) this may not be a problem) or you can
just wrap Event.stopObserving.

More I look your idea more it looks to me like an replacement for
Event.observe. In the ticket the API for event delegation looked like
this

document.delegate('a', 'click', function(e){ console.log(e.target) });

Witch saves a lot of writing and loop calling. Unfortunately my
original idea was to have:

document.delegate('click', {
   'a': log,
   'div': log
});

... but it wasn't approved :( / :)




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to