Help Center

Local Navigation

Object: DocumentFragment

Availability

BlackBerry® Device Software version 4.6 or later

Extends

Node

The DocumentFragment object is a lightweight Document object, used to create or extract only a portion of a document.

A DocumentFragment behaves like a conventional Node object, except that it does not need to be fully formed.

The Range object uses DocumentFragment objects extensively, so that it can extract and store ranges of DOM nodes without creating an entirely new document.

When the children of a DocumentFragment object are inserted into a Document object, only the children of the DocumentFragment, and not the DocumentFragment itself, are inserted into the node.

DocumentFragment methods

Method name

Description

Support level

Availability

querySelector()

Returns the first element within the subtree of the DocumentFragment object that matches the specified selectors.

DOM 1 Selector

5.0 or later

querySelectorAll()

Finds the elements within the subtree of the DocumentFragment object that match the specified selectors, and returns them as a NodeList object.

DOM 1 Selector

5.0 or later

Previous topic: Document methods

Was this information helpful? Send us your comments.