clone Using Document
Type: Function
How to get cloneUsingDocument?
JavaScript
import cloneUsingDocument from 'fontoxml-dom-utils/src/cloneUsingDocument.js'
Clones the given sourceNode
using the targetDocument
to create new nodes.
If sourceNode is a document and the targetDocument already contains an error is raised.
If sourceNode or one of its descendants is of an unsupported type an error is raised.
Note that CDATASection nodes are transformed to Text.
This can be used to copy a node from one DOM implementation to another, like from slimdom to the browser dom and vice-versa.
Use the importNode method present on a Document for importing nodes across the same dom implementation.
Arguments
source
Node (Required)
Type: Node
The source node to clone.
target
Document (Required)
Type: Document
The target document in which to clone the node.
Returns
Type: Node
The result of the clone.