Working together for standards The Web Standards Project


It is not new, but it still is rather clever: In order to avoid having to add event handlers to each and every element you want to monitor, you can use one single handler on a parent element and let browser event bubbling do the rest of the work for you.

Check out this quick example of event handling versus event delegation to see how it is done and what the benefits are.

Your Replies

#1 On September 25th, 2006 12:44 pm Greg Reimer replied:

It would be nice to see some non-Yahoo example code. Interesting though.

#2 On October 2nd, 2006 7:14 am lisongfeng replied:

Heilmann’s idea is greate!

#3 On October 8th, 2006 5:35 am Marc van den Dobbelsteen replied:

This mechanism can be used (i did) to create a event-broadcasting mechanism like we know in the oo-world. This is a very handy model when developing RIA’s (Rich Internet Applications) . You can create loosely coupled interface objects. For example multiple output objects like a graph or gauge, reacting on the value set on a input element like a slider or textbox.

Return to top

Post a Reply

Comments are closed.


All of the entries posted in WaSP Buzz express the opinions of their individual authors. They do not necessarily reflect the plans or positions of the Web Standards Project as a group.

This site is valid XHTML 1.0 Strict, CSS | Get Buzz via RSS or Atom | Colophon | Legal