Next: NodeList Implementation Details
Up: Design Issues
Previous: Tree Structure Differences at
One of the most important interfaces of the DOM Core Specification
is the NodeList interface, which is used to handle ordered lists
of Nodes such as the children of a Node, or the elements returned by
the getElementsByTagName method of the Element interface.
Similarly, there is also a NamedNodeMap interface, used
to handle unordered sets of nodes referenced by their name attribute,
such as the attributes of an Element.
One of their main characteristics is that they are ``live'' structures,
that is, changes to the underlying document structure are automatically
reflected in all relevant NodeList and NamedNodeMap objects.
For example, if a DOM user
gets a NodeList object containing the children of an Element,
and he subsequently adds more children to that element, then
the added children are silently added to the NodeList,
without further action requested from the user side. Of course, changes to a node in the
tree are reflected in all references to that Node in NodeList
and NamedNodeMap objects.