mozilla

Revision 37159 of WRONG DOCUMENT ERR note

  • Revision slug: DOM/WRONG_DOCUMENT_ERR_note
  • Revision title: WRONG DOCUMENT ERR note
  • Revision id: 37159
  • Created:
  • Creator: ziyunfei
  • Is current revision? No
  • Comment 14 words added, 1 words removed

Revision Content

Nodes from external documents should 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.

Firefox does not presently enforce this rule (it did for a while during the development of Firefox 3, but too many sites break when this rule is enforced). We encourage web developers to fix their code to follow this rule for improved future compatibility.

{{ languages( { "fr": "fr/DOM/WRONG_DOCUMENT_ERR_note", "ja": "ja/DOM/WRONG_DOCUMENT_ERR_note", "pl": "pl/DOM/WRONG_DOCUMENT_ERR_note" ,"zh-cn": "zh-cn/DOM/WRONG_DOCUMENT_ERR_note"} ) }}

Revision Source

<p>Nodes from external documents should be cloned using <code><a href="/en/DOM/document.importNode" title="en/DOM/document.importNode">importNode()</a></code> (or adopted using <code><a href="/en/DOM/document.adoptNode" title="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/Node.ownerDocument" title="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>Firefox does not presently enforce this rule (it did for a while during the development of Firefox 3, but too many sites break when this rule is enforced). We encourage web developers to fix their code to follow this rule for improved future compatibility.</p>
<div class="noinclude"> <p>{{ languages( { "fr": "fr/DOM/WRONG_DOCUMENT_ERR_note", "ja": "ja/DOM/WRONG_DOCUMENT_ERR_note", "pl": "pl/DOM/WRONG_DOCUMENT_ERR_note" ,"zh-cn": "zh-cn/DOM/WRONG_DOCUMENT_ERR_note"} ) }}</p>
</div>
Revert to this revision