NodeIterator.pointerBeforeReferenceNode is a read-only boolean. Per MDN, true means the walk pointer is beforereferenceNode; false means it is after that anchor.
Read the notes below before you rely on this property. Prefer feature detection when support is limited.
Syntax
Use iterator.pointerBeforeReferenceNode. Start with this line.
JavaScript
iterator.pointerBeforeReferenceNode
Call
What it does
iterator.pointerBeforeReferenceNode
Primary signature.
Built into the browser. Read iterator.pointerBeforeReferenceNode on a NodeIterator — no import required.
Library declarations
JavaScript
iterator.pointerBeforeReferenceNode
Parameters
This member has no parameters beyond those shown in the signature.
Return Value
Return Value
Description
*
true / false
JavaScript Examples
Example 1 — Read the Flag on Create
MDN idea: after createNodeIterator, read pointerBeforeReferenceNode.
create DIV true
after next DIV false
child SPAN false
How It Works
Snapshot helper. Logs the anchor name and the before/after flag.
On create. Anchor is DIV, flag is true.
First next. Still on DIV, but flag is now false.
Second next. Anchor moves to SPAN; flag stays false.
Compatibility
Browser Support
NodeIterator.pointerBeforeReferenceNode is Baseline Widely available (MDN: across browsers since April 2018). Safe to use without a polyfill in modern teaching and production code.
✓ Baseline · Widely available
pointerBeforeReferenceNode
Read-only boolean: true when the iterator pointer is before referenceNode, false when after.
98%Widely available
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
pointerBeforeReferenceNodeExcellent
Bottom line: Use freely in modern browsers. Pair with referenceNode when you need a full position snapshot.
Frequently Asked Questions
A read-only boolean. true means the iterator pointer sits before referenceNode; false means it sits after referenceNode (MDN).
No. MDN marks NodeIterator.pointerBeforeReferenceNode as Baseline Widely available (across browsers since April 2018). It is not Deprecated, Experimental, or Non-standard.
No. It is read-only. Call nextNode() or previousNode() to move the iterator; the flag updates automatically.
referenceNode is the anchor Node. pointerBeforeReferenceNode tells you whether the walk pointer is immediately before or after that anchor.
Typically true — the pointer starts before the initial referenceNode (usually the root).
A successful nextNode() leaves the pointer after the returned node (false). A successful previousNode() leaves it before the returned node (true).