- From: Jake Hamby <jehamby@earthlink.net>
- Date: Sun, 26 Oct 97 13:22:47 PST
- To: www-dom@w3.org
After reading the DOM draft spec (971009), I'm a bit confused on the semantics for the Node's getPreviousSibling and getNextSibling methods. Originally, I expected from the meaning of the word "sibling" that this would only return the previous or next node in the parent's NodeList. For example, the root node would return null for both methods, and nodes on the same level of the tree, but with different parent nodes, would not be considered siblings. However, in the spec, the methods are defined as using a "breadth-first traversal" of the tree. According to the meaning of traversal, one would expect to be able to traverse the entire tree from any given node, using only getPreviousSibling() and getNextSibling(). Furthermore, the root node would return null for getPreviousSibling(), and its first child for getNextSibling(). For example, starting at the root, and repeatedly calling getNextSibling() should traverse this document in numerical order: 1 /|\ 2 3 4 /\ /\ 5 6 7 8 So which meaning is correct, if any? For the tree above, are there other legal ways to traverse it? Future drafts should probably clarify the semantics of traversal with examples. On a related note, there's an error in either the IDL or description of Node. The text describes a getFirstChild() method, but neither the IDL nor Java classes have it. Which is correct? I'm looking forward to future drafts of this document. Currently, I'm writing a Python implementation, and a web site management tool in Python. If anyone else is interested in collaborating on this project, please let me know. Thanks, Jake Hamby
Received on Sunday, 26 October 1997 16:27:13 UTC