WRONG DOCUMENT ERR note

  • Revision slug: DOM/WRONG_DOCUMENT_ERR_note
  • Revision title: WRONG DOCUMENT ERR note
  • Revision id: 37154
  • Created:
  • Creator: Taken
  • Is current revision? No
  • Comment remove blank lines

Revision Content

Nodes from external documents must be cloned using importNode (or adopted using adoptNode) before they can be inserted into the current document. For more on the ownerDocument issues see the W3C DOM FAQ.

Gecko did not enforce the use of importNode and adoptNode until 1.9. Since 1.9 alphas, failing to adopt or import a node before using it in a different document results in the WRONG_DOCUMENT_ERR (NS_ERROR_DOM_WRONG_DOCUMENT_ERR) exception being thrown. implemented in 47903

{{ wiki.languages( { "fr": "fr/DOM/WRONG_DOCUMENT_ERR_note", "pl": "pl/DOM/WRONG_DOCUMENT_ERR_note" } ) }}

Revision Source

<p>Nodes from external documents must be cloned using <code><a href="en/DOM/document.importNode">importNode</a></code> (or adopted using <code><a href="en/DOM/document.adoptNode">adoptNode</a></code>) before they can be inserted into the current document. For more on the <code><a href="en/DOM/element.ownerDocument">ownerDocument</a></code> issues see the <a class="external" href="http://www.w3.org/DOM/faq.html#ownerdoc">W3C DOM FAQ</a>.
</p><p><a href="en/Gecko">Gecko</a> did not enforce the use of <code>importNode</code> and <code>adoptNode</code> until 1.9. <a href="en/Gecko_1.9_Changes_affecting_websites">Since 1.9 alphas</a>, failing to adopt or import a node before using it in a different document results in the <code>WRONG_DOCUMENT_ERR</code> (<code>NS_ERROR_DOM_WRONG_DOCUMENT_ERR</code>) exception being thrown. <span class="comment">implemented in 47903</span>
</p>
<div class="noinclude">
</div>
{{ wiki.languages( { "fr": "fr/DOM/WRONG_DOCUMENT_ERR_note", "pl": "pl/DOM/WRONG_DOCUMENT_ERR_note" } ) }}
Revert to this revision