W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1997

Clarification request on Node siblings

From: Jake Hamby <jehamby@earthlink.net>
Date: Sun, 26 Oct 97 13:22:47 PST
Message-Id: <199710262126.NAA26679@norway.it.earthlink.net>
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 

For example, starting at the root, and repeatedly calling getNextSibling() 
should traverse this document in numerical order:

 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.

Jake Hamby
Received on Sunday, 26 October 1997 16:27:13 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:03 UTC