http://icant.co.uk/sandbox/eventdelegation/
“Event Delegation” is a technique to get around manually assigning event handlers to multiple, similar elements – e.g. rows in a table or list items. You just assign a single event handler to the parent element, then rely on the browser’s built-in event bubbling to trigger the handler. All you need to do is extract the original target (i.e. the original element that the event occurred upon) to do whatever you will. As Douglas Crockford has mentioned somewhere, this lends weight to the superiority of the bubbling model over the capturing model in that it allows for a form of event inheritance in the browser.
For large content, it can significantly speed up the page significantly and reduce the overall number of bound handlers.
Very cool. I’m going to have to implement this for some Form Tools pages.
Recent Comments