Simon Willison’s Weblog

Subscribe
Atom feed for delegate

1 item tagged “delegate”

2008

jQuery: Changeset 5990. “Added a new liveQuery/event delegation hybrid method”. Lets you add events that continue to work as new elements are dynamically appended to the DOM, e.g. $(’div p.foo’).live(’click’, fn). Works by adding an event handler to the root document element itself and relying on event bubbling. I have to admit I preferred the earlier proposal of $(’div’).delegate(’p.foo’..), which feels like it should have much better performance—anyone know of a good plugin that supports this?

# 23rd December 2008, 12:22 pm / delegate, events, javascript, jquery, livequery