XML DOMLesson 37Free preview
DOM Navigating
This lesson is part of XML · All levels
Summary
In addition to downward, the DOM allows navigation around the node: parentNode or parentElement to parent, nextSibling and previousSibling to sibling in parallel. You have to distinguish between nextSibling that passes through all types of nodes and nextElementSibling that is just an element. Attributes themselves are not part of the brotherhood chain.
Key points
- ParentNode to parent of the current node
- NextSibling and previousSibling navigate the brothers in parallel
- NextElementSibling just goes through the sibling element
- Attributes are not part of the sibling chain of elements
- Navigation allows for exploration without re-selection
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.