jayturley at gmail.com
Tue Feb 10 17:37:33 CST 2009
Currently, as I iterate over a list of items retrieved from the
database, then insert them into the DOM, I am attaching click handlers
to the displayed elements as closures which contain the item IDs from
the database in their execution contexts.
However, as the list of items grows (and it will continue to do so), I
am wondering if I should move to event delegation for processing the
clicks to avoid having umpty-hundreds of closures floating around at
any given time. This requires unique ids for each element which can be
plucked out for use by the event handlers (think the new live()
functionality from jQuery 1.3).
I'm wondering if anyone has looked into the performance issues of
closures versus event delegation (obviously the event delegation is
going to use less memory), and if so what tips or comments you might
Thanks a ton!
More information about the thelist