3 ms·
Uhm, perhaps a stupid question, but how exactly would one build DOM elements without access to the DOM?
by amelius 11y ago
Uhm, perhaps a stupid question, but how exactly would one build DOM elements without access to the DOM?
- rabelrabel 11y agodocument.createDocumentFragment() https://developer.mozilla.org/en/docs/Web/API/Document/createDocumentFragment https://developer.mozilla.org/en/docs/Web/API/Document/creat...
- amelius 11y agoThe documentation says this is faster because the browser does not have to compute reflow during DOM construction. But is this also true if the DOM tree is built "bottom up" (i.e., first the leaves, then their parents, etc, and then finally hook everything into the document body)?
- rabelrabel 11y agoOnly one reflow calc at fragment hookup as opposed to a reflow for every child node added to the main DOM.