Type: Function

How to get cloneUsingDocument?


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.


  1. sourceNode


    Type: Document

    The source node to clone.

  2. targetDocument


    The target document in which to clone the node.


Type: Node

The result of the clone.