This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
While taking this API apart to implement in javascript (as exercise to learn how to read specs) I noticed that methods like firstChild() and lastChild() are stuck on the root node when implementing the specification. For example: > tw = document.createTreeWalker(document.body, NodeFilter.SHOW_ALL).firstChild() In Chrome this returns document.body.firstChild. However when following the spec: | document.createTreeWalker( Node root, .. ) | * http://dom.spec.whatwg.org/#dom-document-createtreewalker | > currentNode = root | TreeWalker::firstChild() | * http://dom.spec.whatwg.org/#concept-traverse-children | > node = current = tw.currentNode | - Filter | - * http://dom.spec.whatwg.org/#concept-node-filter | - > node's nodeType is accepted through NodeFilter.SHOW_ALL | > tw.currentNode = node; // unaltered | > return node; Unless it was intended this way, I appears the spec is missing something in either the Filter or the "Traverse children" subsets to get it off the root. PS: I've looked at all three of these but since I noticed no significant differences in this regard I've only linked to the last one above * http://www.w3.org/TR/2012/WD-dom-20120105/#interface-treewalker * http://www.w3.org/TR/dom/#interface-treewalker * http://dom.spec.whatwg.org/#interface-treewalker
Thanks, should be fixed: https://github.com/whatwg/dom/commit/ff9acf95c68efe5c6fbc718f814da31b4a891a6a I suspect there may be similar bugs elsewhere in Traversal. I guess I should give it all a second look and rewrite some of it. How would you like to be listed in the acknowledgments?
@Anne: Sure, that'd be splendid! And thanks for the quick fix. Much appreciated :)
For name you may use "Timo Tijhof". -- Timo (aka Krinkle) timotijhof@gmail.com github.com/Krinkle about.me/timotijhof