Javascript performance createDocumentFragment vs createElement / innerHTML

Oscar Brito


Using DocumentFragments is faster than repeated single DOM node injection and allows developers to perform DOM node operations (like adding events) on new elements instead of mass-injection via innerHTML.  


var frag = document.createDocumentFragment();

Instead of:


var li = document.createElement("li");




Links:
http://davidwalsh.name/documentfragment
out of dom vs documentfragment ยท jsPerf:




Visit www.divhide.com for more informations, contacts and news about Web Development.
See other blog posts at blog.divhide.com.



Divhide purpose is to follow the HTML5 movement and contribute with applications which prove the quality of technology.


Feel free to contact divhide.