ZVON > References > DOM2 Reference

DocumentFragment (interface )

Type of the interface:   fundamental

Own properties:
attributes  -  none
methods  -  none

Inherited properties:
attributes  -  attributes, childNodes, firstChild, lastChild, localName, namespaceURI, nextSibling, nodeName, nodeType, nodeValue, ownerDocument, parentNode, prefix, previousSibling
methods  -  appendChild, cloneNode, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild

For some cases (extracting a portion of a document's tree, creating a new fragment of a document, inserting nodes as children of another node) it is desirable to have an object which can hold fragments of document. Document object itself is a little bit heavyweight for this, something lightweight that behaves like Node is much better. And exactly this is DocumentFragment.

When a DocumentFragment is inserted into a Document (or indeed any other Node that may take children) the children of the DocumentFragment and not the DocumentFragment itself are inserted into the Node.