Bugzilla – Bug 15252
Documentation error - TreeWalker.nextNode()
Last modified: 2011-12-17 11:01:36 UTC
The current instructions for implementing this method can be found at http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-treewalker-nextnode.
Step 3.2 states that implementors should:
"If a node is following node and is not following root, set node to the first such node. Otherwise, run these substeps again."
Earlier in the steps, you were instructed to set node to currentNode. Since currentNode is always a descendant of root, this means that the first "if" statement is never true - the "otherwise" or "else" clause is executed immediately. After some thought, I believe that you meant the following instead:
"If a node is following node and is A DESCENDANT OF root, set node to the first such node. Otherwise, run these substeps again."
If this is what you meant, then please change it. If not, then please clear up exactly what you meant.
Also, there is a step 3.3, so consider changing the second sentence of 3.2 to "Otherwise, SKIP THE REMAINING SUBSTEPS AND THEN run them again." or "Otherwise, SKIP STEP 3 AND THEN run these substeps again."
currentNode can be set to anything so it does not have to be a descendant.
I have made the clarification in the end.