TOC PREV NEXT INDEX

domref



cloneContents


Returns a document fragment copying the nodes of a Range.

Syntax

documentFragment = range.cloneContents();
 

Parameters

documentFragment is a document fragment

Example

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

Notes

Event Listeners added using DOM Events are not copied during cloning. HTML attribute events are duplicated as they are for the DOM Core 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.

Specification

cloneContents


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