You should have used DOM DocumentFragments
Feb 3, 2011
Dick Brouwer
1 minute read

I just came across DocumentFragments (writup by John Resig) - I hadn’t heard of these before, or at least never used them. They can be really helpful if you want to insert a bunch of stuff in the DOM in a loop, but need to do it faster. It should be 2-4x faster vs. regular inserts. Oh, and the best thing: it’s compatible even with IE6.

I wasn’t fast enough to insert 500+ items in the sidebar of my latest project: Journly unfortunately, so I opted for a insert-in-DOM-while-scrolling method (endless scrolling) instead. More on that later.

comments powered by Disqus