XML DOM cloneNode() Method

The following code fragment loads "books.xml", clones the first <book> node and then adds it to the end of the node list

Definition and Usage

The cloneNode() method creates a copy of a node, and returns the newly clone node.

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The cloneNode() method is supported in all major browsers.

Syntax

nodeObject.cloneNode(deep)

Parameters

Parameter Type Description
deep Boolean true clones the node, its attributes, and its descendants. false clones the node and its attributes.

Return Value

Type Description
Node object The cloned node

Technical Details

DOM Version Core Level 1 Node Object

❮ Node Object