NodeIterator.detach

  • Revision slug: DOM/NodeIterator.detach
  • Revision title: NodeIterator.detach
  • Revision id: 136562
  • Created:
  • Creator: Jürgen Jeka
  • Is current revision? No
  • Comment 4 words added, 4 words removed

Revision Content

{{ DomRef() }}

{{ gecko_minversion_header("1.9.1") }}

Summary

Detaches the NodeIterator from the set over which it iterates, releasing any resources used by the set and setting the iterator's state to INVALID.

Once this method has been called, calls to other methods on NodeIterator will raise the INVALID_STATE_ERR exception.

Syntax

nodeIterator.detach();

Example

var nodeIterator = document.createNodeIterator(
    document.body,
    NodeFilter.SHOW_ELEMENT,
    { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
    false
);
nodeIterator.detach(); // detaches the iterator

nodeIterator.nextNode(); // throws an INVALID_STATE_ERR exception

 

Revision Source

<p>{{ DomRef() }}</p>
<p>{{ gecko_minversion_header("1.9.1") }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Detaches the <a class="internal" href="/En/DOM/NodeIterator" title="En/DOM/NodeIterator"><code>NodeIterator</code></a> from the set over which it iterates, releasing any resources used by the set and setting the iterator's state to <code>INVALID</code>.</p>
<p>Once this method has been called, calls to other methods on <code>NodeIterator</code> will raise the <code>INVALID_STATE_ERR</code> exception.</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre class="eval">nodeIterator.detach();
</pre>
<h3 id="Example" name="Example">Example</h3>
<pre class="eval">var nodeIterator = document.createNodeIterator(
    document.body,
    NodeFilter.SHOW_ELEMENT,
    { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
    false
);
nodeIterator.detach(); // detaches the iterator

nodeIterator.nextNode(); // throws an INVALID_STATE_ERR exception
</pre>
<p> </p>
Revert to this revision