NodeIterator.detach

  • Revision slug: Web/API/NodeIterator.detach
  • Revision title: NodeIterator.detach
  • Revision id: 451781
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ DomRef("NodeIterator) }}{{obsolete_header}}

The NodeIterator.detach() method is a no-op, kept for backward compatibility only.

Originally, it detached the {{cssxref("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 had been called, calls to other methods on NodeIterator would 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

Specifications

Specification Status Comment
{{SpecName('DOM WHATWG', '#dom-nodeiterator-detach', 'NodeIterator.detach')}} {{Spec2('DOM WHATWG')}} Transformed in a no-op
{{SpecName('DOM2 Traversal_Range', 'traversal.html#Traversal-NodeIterator-detach', 'NodeIterator.detach')}} {{Spec2('DOM2 Traversal_Range')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 {{CompatGeckoDesktop("1.9.1")}}
Since {{CompatGeckoDesktop("22")}}, acts as a no-op.
9.0 9.0 3.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatGeckoMobile("1.9.1")}}
Since {{CompatGeckoDesktop("22")}}, acts as a no-op.
{{CompatVersionUnknown}} 9.0 3.0

See also

  • The interface it belongs to: {{domxref("NodeIterator")}}.

Revision Source

<p>{{ DomRef("NodeIterator) }}{{obsolete_header}}</p>
<p>The <strong><code>NodeIterator.detach()</code></strong> method is a no-op, kept for backward compatibility only.</p>
<p>Originally, it detached the {{cssxref("NodeIterator")}} from the set over which it iterates, releasing any resources used by the set and setting the iterator's state to <code>INVALID</code>. Once this method had been called, calls to other methods on <code>NodeIterator</code> would raise the <code>INVALID_STATE_ERR</code> exception.&nbsp;</p>
<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="eval">
<em>nodeIterator</em>.detach();
</pre>
<h2 id="Example" name="Example">Example</h2>
<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>
<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', '#dom-nodeiterator-detach', 'NodeIterator.detach')}}</td>
      <td>{{Spec2('DOM WHATWG')}}</td>
      <td>Transformed in a no-op</td>
    </tr>
    <tr>
      <td>{{SpecName('DOM2 Traversal_Range', 'traversal.html#Traversal-NodeIterator-detach', 'NodeIterator.detach')}}</td>
      <td>{{Spec2('DOM2 Traversal_Range')}}</td>
      <td>Initial definition.</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>1.0</td>
        <td>{{CompatGeckoDesktop("1.9.1")}}<br />
          Since {{CompatGeckoDesktop("22")}}, acts as a no-op.</td>
        <td>9.0</td>
        <td>9.0</td>
        <td>3.0</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatGeckoMobile("1.9.1")}}<br />
          Since {{CompatGeckoDesktop("22")}}, acts as a no-op.</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>9.0</td>
        <td>3.0</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li>The interface it belongs to: {{domxref("NodeIterator")}}.</li>
</ul>
Revert to this revision