TOC PREV NEXT INDEX

domref



extractContents


Moves contents of a Range from the document tree into a document fragment.

Syntax

documentFragment = range.extractContents();
 

Parameters

documentFragment is a document fragment

Example

range = document.createRange();
 
range.selectNode(document.getElementsByTagName("div").item(0));
 
documentFragment = range.extractContents();
 
document.body.appendChild(documentFragment);
 

Notes

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

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

Specification:

extractContents


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX