cloneContents method

DocumentFragment cloneContents()

The Range.cloneContents() returns a DocumentFragment copying the objects of type Node included in the Range.

Event listeners added using EventTarget.addEventListener are not copied during cloning. HTML attribute events are duplicated as they are for the Node.cloneNode method. HTML id attributes are also cloned, which can lead to an invalid document through cloning.

Partially selected nodes include the parent tags necessary to make the document fragment valid.

Implementation

external DocumentFragment cloneContents();