Returns a duplicate of the current node.
dupNode = element.cloneNode(deep);
deepis a required boolean value indicating whether the clone is a deep clone or not (see notes below).
p = document.getElementById("para1"); p_prime = p.cloneNode(true);
Cloning a node copies all of its attributes and their values.
The duplicate node returned by
cloneNode is not part of the document until it is added to another node that is part of the document using appendChild or a similar method. It also has no parent until it is appended to another node.
deep is set to false, none of the child nodes are cloned. Any text that the node contains is not cloned either as it is contained in one or more child
deep evaluates to true, the whole subtree (including text that may be in child Text nodes) is copied too. For empty nodes (e.g. IMG and INPUT elements) it doesn't matter whether
deep is set to true or false but you still have to provide a value.