On Feb 22, 9:45 pm, Diego Perini <[email protected]> wrote: > On Tue, Feb 22, 2011 at 3:30 AM, RobG <[email protected]> wrote: > > > On Feb 22, 12:09 pm, Diego Perini <[email protected]> wrote: > >> Mark, > >> use event "delegation" and only setup one listener on the "document" > >> for the type of event you want notifications. > > > And for those events that don't bubble? > > In older browsers like IE only few events do not bubble and those are > the events bound to form controls (submit/reset/change/focus/blur).
You mean in *all* browsers that implement what the W3C calls "HTML event types". <URL: http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-htmlevents > Event delegation is a good strategy where it can be used to replace multiple (usually identical or very similar, but not always) listeners on a group of elements. But it can be inefficient and is not suitable where only a few listeners are required. Placing a single listener on the document to handle all events can create more comlexity and issues than it solves. It may be better to use an element that is a closer ancestor of the subject elements, or just attach listeners directly. The solution should fit the requirements, be robust and easily maintainable. [...] > If a complete cross-browser implementation is needed you can use my > NWEvents project Looks interesting, I'll have a play. -- Rob -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
