Ticket #9903 (closed enhancement: worksforme)
Slow DOM manipulation because .append() can't use documentFragments
|Reported by:||magentix@…||Owned by:|
Most of us know you should touch the DOM as little as possible, especially within loops. Now, suppose you have a data set that is used to build event handlers for, let's say, list items.
Now in jQuery, you can only do this if you concatenate a HTML string within the loop and then add that string to the DOM with .append(). That's all dandy, until you need to add event handlers to the newly created HTML.
I've opened a ticket in the past about how .append() should be enhanced to accept documentFragments, but that was closed down due to bad use case.
Therefore I've created a jsFiddle with three cases in it:
- current situation
- preferred situation
- current workaround
Please take a look at: http://jsfiddle.net/cbEEW/1/