Class NodeIterator
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The NodeIterator interface represents an iterator to traverse nodes of a DOM subtree in document order.
[Value("NodeIterator")]
public class NodeIterator
- Inheritance
-
NodeIterator
- Inherited Members
Remarks
A NodeIterator can be created using the CreateNodeIterator(Node, ulong, NodeFilter?) method, as follows:
-The creator method: CreateNodeIterator(Node, ulong, NodeFilter?).
-Related interface: TreeWalker
Constructors
NodeIterator()
public NodeIterator()
Properties
Filter
The NodeIterator.filter read-only property returns aNodeFilter object, that is an object which implements anacceptNode(node) method, used to screen nodes.
[Value("filter")]
public NodeFilter? Filter { get; }
Property Value
- NodeFilter
A
NodeFilterobject.
Remarks
When creating the NodeIterator, the filter object is passed in as the
third parameter, and the object method acceptNode(node) is
called on every single node to determine whether or not to accept it. This function
should return the constant NodeFilter.FILTER_ACCEPT for cases when the
node should be accepted and NodeFilter.FILTER_REJECT for cases when the
node should be rejected.
-The interface this property belongs to: NodeIterator.
PointerBeforeReferenceNode
The NodeIterator.pointerBeforeReferenceNode read-only
property returns a boolean flag that indicates whether theNodeFilter is anchored before (if this value is true) or
after (if this value is false) the anchor node indicated by the
ReferenceNode property.
[Value("pointerBeforeReferenceNode")]
public bool PointerBeforeReferenceNode { get; }
Property Value
- bool
A boolean.
Remarks
-The interface it belongs to: NodeIterator
ReferenceNode
The NodeIterator.referenceNode read-only property returns the
Node to which the iterator is anchored; as new nodes are inserted, the
iterator remains anchored to the reference node as specified by this property.
[Value("referenceNode")]
public Node ReferenceNode { get; }
Property Value
Remarks
-The interface it belongs to: NodeIterator
Root
The NodeIterator.root read-only property represents the
Node that is the root of what the NodeIterator
traverses.
[Value("root")]
public Node Root { get; }
Property Value
Remarks
-The interface it belongs to: NodeIterator.
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.
[Value("whatToShow")]
public ulong WhatToShow { get; }
Property Value
- ulong
An
unsigned integer.The values that can be combined to form the bitmask are:
Remarks
-The interface this property belongs to: NodeIterator.
Methods
Detach()
IMPORTANT
DeprecatedNodeIterator.detach() method is a no-op, kept forbackward compatibility only.
[Value("detach")]
public GlobalObject.Undefined Detach()
Returns
Remarks
Originally, it detached the NodeIterator from the set over which it
iterates, releasing any resources used by the set and setting the iterator's state toINVALID. Once this method had been called, calls to other methods onNodeIterator would raise the INVALID_STATE_ERR exception.
-The interface it belongs to: NodeIterator.
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.
[Value("nextNode")]
public Node? NextNode()
Returns
- Node
A Node representing the node after the current node in the set represented by this
NodeIterator, ornullif the current node is the last node in the set.
Remarks
This method returns null when there are no nodes left in the set.
In old browsers, as specified in old versions of the specifications, the method may
throws the INVALID_STATE_ERR DOMException if this method
is called after the Detach() method. Recent browsers never
throw.
-The interface it belongs to: NodeIterator.
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.
[Value("previousNode")]
public Node? PreviousNode()
Returns
- Node
A Node representing the node before the current node in the set represented by this
NodeIterator, ornullif the current node is the first node in the set.
Remarks
This method returns null when the current node is the first node in the
set.
In old browsers, as specified in old versions of the specifications, the method may
throws the INVALID_STATE_ERR DOMException if this method
is called after the Detach() method. Recent browsers never
throw.
-The interface it belongs to: NodeIterator.