W3cubDocs

/Haxe JavaScript

NodeIterator

package js.html

Available on js

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.

Documentation NodeIterator by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Variables

read onlyfilter:EitherType<Node ‑> Int, NodeFilter>

Returns a NodeFilter used to select the relevant nodes.

read onlypointerBeforeReferenceNode:Bool

Returns a Boolean flag that indicates whether the NodeIterator is anchored before, the flag being true, or after, the flag being false, the anchor node.

read onlyreferenceNode:Node

Returns the Node to which the iterator is anchored.

read onlyroot:Node

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

read onlywhatToShow:Int

Returns an unsigned long being a bitmask made of constants describing the types of Node that must to be presented. Non-matching nodes are skipped, but their children may be included, if relevant. The possible values are:

	<tr>
		<td class="header">Constant</td>
		<td class="header">Numerical value</td>
		<td class="header">Description</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_ALL</code></td>
		<td><code>-1</code> (that is the max value of <code>unsigned long</code>)</td>
		<td>Shows all nodes.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_ATTRIBUTE</code> <em>(deprecated)</em></td>
		<td><code>2</code></td>
		<td>Shows attribute <code>Attr</code> nodes. This is meaningful only when creating a <code>NodeIterator</code> with an <code>Attr</code> node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal. Since attributes are never children of other nodes, they do not appear when traversing over the document tree.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_CDATA_SECTION</code> <em>(deprecated)</em></td>
		<td><code>8</code></td>
		<td>Shows <code>CDATASection</code> nodes.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_COMMENT</code></td>
		<td><code>128</code></td>
		<td>Shows <code>Comment</code> nodes.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_DOCUMENT</code></td>
		<td><code>256</code></td>
		<td>Shows <code>Document</code> nodes.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_DOCUMENT_FRAGMENT</code></td>
		<td><code>1024</code></td>
		<td>Shows <code>DocumentFragment</code> nodes.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_DOCUMENT_TYPE</code></td>
		<td><code>512</code></td>
		<td>Shows <code>DocumentType</code> nodes.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_ELEMENT</code></td>
		<td><code>1</code></td>
		<td>Shows <code>Element</code> nodes.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_ENTITY</code> <em>(deprecated)</em></td>
		<td><code>32</code></td>
		<td>Shows <code>Entity</code> nodes. This is meaningful only when creating a <code>NodeIterator</code> with an <code>Entity</code> node as its root; in this case, it means that the <code>Entity</code> node will appear in the first position of the traversal. Since entities are not part of the document tree, they do not appear when traversing over the document tree.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_ENTITY_REFERENCE</code> <em>(deprecated)</em></td>
		<td><code>16</code></td>
		<td>Shows <code>EntityReference</code> nodes.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_NOTATION</code> <em>(deprecated)</em></td>
		<td><code>2048</code></td>
		<td>Shows <code>Notation</code> nodes. This is meaningful only when creating a <code>NodeIterator</code> with a <code>Notation</code> node as its root; in this case, it means that the <code>Notation</code> node will appear in the first position of the traversal. Since entities are not part of the document tree, they do not appear when traversing over the document tree.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_PROCESSING_INSTRUCTION</code></td>
		<td><code>64</code></td>
		<td>Shows <code>ProcessingInstruction</code> nodes.</td>
	</tr>
	<tr>
		<td><code>NodeFilter.SHOW_TEXT</code></td>
		<td><code>4</code></td>
		<td>Shows <code>Text</code> nodes.</td>
	</tr>

Methods

detach():Void

This operation is a no-op. It doesn't do anything. Previously it was telling the engine that the NodeIterator was no more used, but this is now useless.

nextNode():Node

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

Throws:

null

DOMError

previousNode():Node

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

Throws:

null

DOMError

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/NodeIterator.html