GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — NodeIterator - Web APIs | MDN

NodeIterator

Baseline
Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

  • See full compatibility
  • Learn more

The NodeIterator interface represents an iterator to traverse nodes of a DOM subtree in document order.

A NodeIterator can be created using the Document.createNodeIterator() method, as follows:

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

Instance properties

This interface doesn't inherit any property.

NodeIterator.root Read only

Returns a Node representing the root node, as specified when the NodeIterator was created.

NodeIterator.whatToShow Read only

Returns an unsigned long bitmask that describes the types of Node to be matched. Non-matching nodes are skipped, but relevant child nodes may be included.

NodeIterator.filter Read only

Returns a NodeFilter used to select the relevant nodes.

NodeIterator.referenceNode Read only

Returns the Node to which the iterator is anchored.

NodeIterator.pointerBeforeReferenceNode Read only

Returns a boolean indicating whether or not the NodeIterator is anchored before the NodeIterator.referenceNode. If false, it indicates that the iterator is anchored after the reference node.

Instance methods

This interface doesn't inherit any method.

NodeIterator.detach()

This is a legacy method, and no longer has any effect. Previously it served to mark a NodeIterator as disposed, so it could be reclaimed by garbage collection.

NodeIterator.previousNode()

Returns the previous Node in the document, or null if there are none.

NodeIterator.nextNode()

Returns the next Node in the document, or null if there are none.

Specifications

Specification
DOM
# interface-nodeiterator

Browser compatibility

See also

  • The creator method: Document.createNodeIterator().
  • Related interface: TreeWalker

Help improve MDN

Learn how to contribute

This page was last modified on Oct 23, 2025 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.