Skip to main content

class NodeIterator

Iterable object that can be used in for/of iteration.

properties:​

root​

read-only, returns a Node representing the root node, as specified in createNodeIterator.

filter​

read-only, returns filter object used in createNodeIterator

whatToShow​

read-only, integer, ORed mask bits.

referenceNode​

read-only, current Node.

methods:​

nextNode()​

previousNode()​

return the next/previous Node in the document, or null if there are none.

constants:​

NodeFilter mask bits​

NameMeaning
NodeFilter.SHOW_ALLShows all nodes
NodeFilter.SHOW_ELEMENTElements
NodeFilter.SHOW_TEXTText nodes
NodeFilter.SHOW_COMMENTComment nodes
NodeFilter.SHOW_DOCUMENTDocument nodes