mozilla

Revision 450575 of NodeIterator

  • Revision slug: Web/API/NodeIterator
  • Revision title: NodeIterator
  • Revision id: 450575
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment
Tags: 

Revision Content

{{ DomRef() }}

{{ gecko_minversion_header("1.9.1") }}

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.

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

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

Properties

This interface doesn't inherit any property.

{{domxref("NodeIterator.root")}} {{readonlyInline}}
...
{{domxref("NodeIterator.whatToShow")}} {{readonlyInline}}
...
{{domxref("NodeIterator.filter")}} {{readonlyInline}}
...
{{domxref("NodeIterator.expandEntityReferences")}} {{readonlyInline}} {{obsolete_inline}}
...
{{domxref("NodeIterator.referenceNode")}} {{readonlyInline}} {{experimental_inline() }}
...
{{domxref("NodeIterator.pointerBeforeReferenceNode")}} {{readonlyInline}} {{ experimental_inline() }}
...

Methods

This interface doesn't inherit any method.

{{domxref("NodeIterator.detach")}}
...
{{domxref("NodeIterator.previousNode")}}
...
{{domxref("NodeIterator.nextNode")}}
...

Specifications

Specification Status Comment
{{SpecName('DOM WHATWG', '', 'NodeIterator')}} {{Spec2('DOM WHATWG')}} Added the properties referenceNode and pointerBeforeReferenceNode.
Removed the property expandEntityReferences.
The method detach() has been changed to be a no-op.
The methods previousNode() and nextNode() don't raise an exception any more.
{{SpecName('DOM2 Traversal_Range', 'traversal.html#Iterator-overview', 'NodeIterator')}} {{Spec2('DOM2 Traversal_Range')}} Initial definition.

See also

  • The creator method: {{domxref("Document.createNodeIterator()")}}.

Revision Source

<p>{{ DomRef() }}</p>
<p>{{ gecko_minversion_header("1.9.1") }}</p>
<p>The <strong><code>NodeIterator</code></strong> 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.</p>
<p>A <code>NodeIterator</code> can be created using the {{domxref("Document.createNodeIterator()")}} method, as follows:</p>
<pre class="brush: js">
var nodeIterator = document.createNodeIterator(root, whatToShow, filter);</pre>
<h2 id="Properties" name="Properties">Properties</h2>
<p><em>This interface doesn't inherit any property.</em></p>
<dl>
  <dt>
    {{domxref("NodeIterator.root")}} {{readonlyInline}}</dt>
  <dd>
    ...</dd>
  <dt>
    {{domxref("NodeIterator.whatToShow")}} {{readonlyInline}}</dt>
  <dd>
    ...</dd>
  <dt>
    {{domxref("NodeIterator.filter")}} {{readonlyInline}}</dt>
  <dd>
    ...</dd>
  <dt>
    {{domxref("NodeIterator.expandEntityReferences")}} {{readonlyInline}} {{obsolete_inline}}</dt>
  <dd>
    ...</dd>
  <dt>
    {{domxref("NodeIterator.referenceNode")}} {{readonlyInline}} {{experimental_inline() }}</dt>
  <dd>
    ...</dd>
  <dt>
    {{domxref("NodeIterator.pointerBeforeReferenceNode")}} {{readonlyInline}} {{ experimental_inline() }}</dt>
  <dd>
    ...</dd>
</dl>
<h2 id="Methods" name="Methods">Methods</h2>
<p><em>This interface doesn't inherit any method.</em></p>
<dl>
  <dt>
    {{domxref("NodeIterator.detach")}}</dt>
  <dd>
    ...</dd>
  <dt>
    {{domxref("NodeIterator.previousNode")}}</dt>
  <dd>
    ...</dd>
  <dt>
    {{domxref("NodeIterator.nextNode")}}</dt>
  <dd>
    ...</dd>
</dl>
<h2 id="Specification" name="Specification">Specifications</h2>
<table class="standard-table">
  <tbody>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
    <tr>
      <td>{{SpecName('DOM WHATWG', '', 'NodeIterator')}}</td>
      <td>{{Spec2('DOM WHATWG')}}</td>
      <td>Added the properties <code>referenceNode</code> and <code>pointerBeforeReferenceNode</code>.<br />
        Removed the property <code>expandEntityReferences</code>.<br />
        The method <code>detach()</code> has been changed to be a no-op.<br />
        The methods <code>previousNode()</code> and <code>nextNode()</code> don't raise an exception any more.</td>
    </tr>
    <tr>
      <td>{{SpecName('DOM2 Traversal_Range', 'traversal.html#Iterator-overview', 'NodeIterator')}}</td>
      <td>{{Spec2('DOM2 Traversal_Range')}}</td>
      <td>Initial definition.</td>
    </tr>
  </tbody>
</table>
<h2 id="See_also">See also</h2>
<ul>
  <li>The creator method: {{domxref("Document.createNodeIterator()")}}.</li>
</ul>
Revert to this revision