extractContents method

DocumentFragment extractContents()

The Range.extractContents() method moves contents of the Range from the document tree into a DocumentFragment.

Event listeners added using DOM Events are not retained during extraction. HTML attribute events are retained or duplicated as they are for the Node.cloneNode method. HTML id attributes are also cloned, which can lead to an invalid document if a partially-selected node is extracted and appended to the document.

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

Implementation

external DocumentFragment extractContents();