XML DOMLesson 44Free preview
DOM Clone Nodes
This lesson is part of XML · All levels
Summary
The cloneNode makes a copy of a node. With the parameter false only the node itself is copied, whereas with true the entire descendant subtree is copied. The resulting copy has not yet been attached to the tree so it can be freely modified and added as needed.
Key points
- Copy the node without a descendant
- CloneNode(true) copying the node and the entire subtree
- The node attribute is involved in the cloning process
- The original copy is not yet attached to the tree
- Effective cloning for repeating repeating structures
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.