document.adoptNode() is an instance method that moves a node from another document into the current one. Learn how ownerDocument changes, why parentNode is null until you insert, MDN’s iframe example, and how adoptNode differs from importNode and cloneNode.
01
Kind
Instance method
02
Arg
externalNode
03
Returns
same node
04
Effect
Moves node
05
vs import
move vs copy
06
Status
Baseline
Fundamentals
Introduction
Every DOM node belongs to a Document through ownerDocument. When you build nodes in an iframe, a detached Document, or parsed HTML, those nodes live in a different document than your main page.
MDN: Document.adoptNode(externalNode) transfers a node from another document into the method’s document. The adopted node and its subtree are removed from their original document, and ownerDocument changes to the current document. You can then insert it with appendChild().
💡
Adopt or import first (MDN)
Before inserting nodes from external documents, MDN says you should either clone with document.importNode() or adopt with document.adoptNode(). Appending a foreign node without either can fail or behave inconsistently.
Document.adoptNode() is Baseline Widely available (MDN: across browsers since July 2015). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline Widely available
Document.adoptNode()
Move nodes between documents — change ownerDocument, then append.
BaselineWidely available
Google ChromeSupported
Yes
Microsoft EdgeSupported
Yes
Mozilla FirefoxSupported
Yes
Apple SafariSupported
Yes
OperaSupported
Yes
Internet Explorer9+
Yes
adoptNode()Baseline
Bottom line: Use document.adoptNode() to move foreign nodes into the current document. Prefer importNode when you need a copy instead of a move.
Wrap Up
Conclusion
document.adoptNode() moves a node from another document into the current one. MDN: the node is removed from its source, ownerDocument updates, and parentNode stays null until you insert it.
Adopt or import foreign nodes before inserting (MDN)
Call appendChild after adoption to attach the node
Use importNode when the source must keep its node
Check ownerDocument when debugging cross-document bugs
Reuse the returned reference—it is the same object (MDN)
❌ Don’t
Append foreign nodes without adopt/import (MDN)
Assume adoption also inserts into the tree
Use adoptNode when you only need a copy—use importNode
Forget iframe same-origin rules for contentDocument
Confuse adopt with appendChild same-document moves
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about adoptNode()
Move foreign nodes — adopt, then append.
5
Core concepts
📝01
Kind
instance
document.
🗂02
Moves
node
MDN
🔗03
Same ref
returned
MDN
✓04
parent
null first
Insert
🛡05
Status
baseline
2015
❓ Frequently Asked Questions
It transfers a node from another document into the current document. The node and its subtree are removed from the original document (if any), and ownerDocument changes to the current document (MDN).
No. MDN marks Document.adoptNode() as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
The adopted node in the scope of the importing document. After the call, the return value and the original externalNode reference are the same object (MDN).
MDN: the adopted node's parentNode is null because it has not yet been inserted into the document tree. Call appendChild or similar to attach it.
adoptNode moves the original node (removes it from the source document). importNode clones the node into the current document and leaves the source unchanged.
Use importNode when you need a copy in the current document while keeping the node in the source document, or when cloning parsed HTML from a detached Document (MDN notes).
Did you know?
MDN notes that after document.adoptNode(externalNode), the returned node and externalNode are the same object—but parentNode is still null until you call appendChild or another insertion method.