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.
- Flag to specify whether or not the children of entity reference nodes are visible.
- Gets the currently applied NodeFilter to the traversal.
- The NodeIterator.root read-only property represents the Node that is the root of what the NodeIterator traverses.
- The NodeIterator.whatToShow read-only property represents an unsigned integer representing a bitmask signifying what types of nodes should be returned by the NodeIterator.
- 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.
- 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.
var nodeIterator = document.createNodeIterator(root, whatToShow, filter);
Used in web browser Developer Tools UI to provide a consistent and interoperable means of traversing DOM Nodes.
The NodeIterator is dynamic, reflecting the state of the document as it is edited or changed.