TOC PREV NEXT INDEX

domref



cloneNode


The cloneNode method returns a duplicate of the current node.

Syntax

dupNode = element.cloneNode(deep)
 

Parameters

deep is a boolean value indicating whether the clone is a deep clone or not (see notes below).

Example

p = document.getElementById("para1");
 
p_prime = p.cloneNode(true);
 

Notes

The duplicate node returned by cloneNode() has no parent. Cloning a node copies all of its attributes and their values but does not copy any of the text that the node contains, since that text is contained in a child Text node.

A deep clone is a clone in which the given node and the whole subtree beneath it (including the text that makes up any child Text nodes) is copied and returned.

Specification

cloneNode
 


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