JavaScripture
Contribute via GitHub Feedback

JavaScript DocumentFragment : Node

A DocumentFragment is a container for Nodes. When adding a DocumentFragment to a Node, all the children of the DocumentFragment become direct children of the Node. Use document.createDocumentFragment() to create a DocumentFragment.

Instance Methods

querySelector(cssSelector : String) : Element

Returns the first Element that matches the CSS selector.

Example:

Run

Results:

 

querySelectorAll(cssSelector : String) : NodeList

Returns a NodeList containing the Elements in the document that match the CSS selector.

Example:

Run

Results: