DOM:document.createDocumentFragment
From MDC
Contents |
[edit] Summary
Creates an empty document fragment.
[edit] Syntax
var docFragment = document.createDocumentFragment();
docFragment is a reference to an empty DocumentFragment object.
[edit] Example
var frag = document.createDocumentFragment();
frag.appendChild(document.createTextNode('Ipsum Lorem'));
document.body.appendChild(frag);
[edit] Notes
A DocumentFragment is a minimal document object that has no parent. It supports the following DOM 2 methods: appendChild, cloneNode, hasAttributes, hasChildNodes, insertBefore, normalize, removeChild, replaceChild.
It also supports the following DOM 2 properties: attributes, childNodes, firstChild, lastChild, localName, namespaceURI, nextSibling, nodeName, nodeType, nodeValue, ownerDocument, parentNode, prefix, previousSibling, textContent.
Various other methods can take a document fragment as an argument (e.g. Node interface methods such as appendChild and insertBefore), in which case the children of the fragment are appended or inserted, not the fragment itself.
[edit] Specification
DOM Level 2: createDocumentFragment