Adopt the first <h1> element that appears in an iframe (another document):
The adoptNode() method adopts a node from another document.
The adopted node can be of all node types.
Note: All child nodes (descendants), if any, of the adopted node, are also adopted.
Note: The original node (and its child nodes, if any) is removed from the other document.
Tip: Use the document.importNode() method to copy a node, without removing it, from another document.
Tip: Use the element.cloneNode() method to copy a node, without removing it, from the current document.
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
adoptNode() | Yes | 9.0 | 3.0 | Yes | 9.0 |
Parameter | Type | Description |
---|---|---|
node | Node object | Required. The node from another document. Can be of any node type |
Return Value: | A Node object, representing the adopted node |
---|---|
DOM Version | Core Level 3 Document Object |