This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

NodeIterator

Summary

The NodeIterator interface represents an iterator over the members of a list of the nodes in a subtree of the DOM. The nodes will be returned in document order.

Properties

expandEntityReferences
Flag to specify whether or not the children of entity reference nodes are visible.
filter
Gets the currently applied NodeFilter to the traversal.
root
The NodeIterator.root read-only property represents the Node that is the root of what the NodeIterator traverses.
whatToShow
The NodeIterator.whatToShow read-only property represents an unsigned integer representing a bitmask signifying what types of nodes should be returned by the NodeIterator.

Methods

nextNode
The NodeIterator.nextNode() method returns the next node in the set represented by the NodeIterator and advances the position of the iterator within the set. The first call to nextNode() returns the first node in the set. This method returns null when there are no nodes left in the set.
previousNode
The NodeIterator.previousNode() method returns the previous node in the set represented by the NodeIterator and moves the position of the iterator backwards within the set.

Events

No events.

Examples

var nodeIterator = document.createNodeIterator(root, whatToShow, filter);

Usage

 Used in web browser Developer Tools UI to provide a consistent and interoperable means of traversing DOM Nodes.

Notes

Remarks

The NodeIterator is dynamic, reflecting the state of the document as it is edited or changed.

Standards information

Attributions