Bugzilla – Bug 20445
TreeWalker: Specified workflow stuck at root node
Last modified: 2012-12-19 20:38:09 UTC
> 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
| * 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
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)