📜 ⬆️ ⬇️

DOM DocumentFragment: Faster Fast

Note: below is the translation of a note from John Resig DOM “DOM DocumentFragments” , in which the author tells about the experience of using DocumentFragment and compares its speed with the usual appendChild . My comments further in italics.

I recently played with a DOM DocumentFragment in JavaScript, trying to figure out what to do with it. In short, DocumentFragment is a lightweight container for DOM nodes. It is part of the DOM 1 specification and is supported in all modern browsers (it was added to Internet Explorer in version 6).

In the process of reading, I came across an interesting thing. I quote from the specification:
')
Also, various operations — for example, adding nodes as children of another Node — can take DocumentFragment objects as an argument; as a result, all the child nodes of this DocumentFragment moved to the list of child nodes of the current node.


read further on webo.in →

Source: https://habr.com/ru/post/31655/


All Articles