XML DOMLesson 36Free preview
DOM Traversing
This lesson is part of XML · All levels
Summary
Tracking the DOM tree means moving from one node to another through hierarchical relationships. The childNodes property returns the entire child including the text, whereas the children are just elements. firstChild and lastChild designate the first and last child, so the structure can be explored without re-selection.
Key points
- ChildNodes contain all child nodes including text nodes
- Children only contains children in the form of elements
- FirstChild and lastChild designate first and last child
- Tracing the tree follows the hierarchical structure of the document
- Whitespace in HTML can generate additional text nodes
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.