[dom] Behaviour for pointerBeforeReferenceNode when all nodes do not pass filtration

None via GitHub <[email protected]> Thu, 08 Oct 2015 04:06:06 +0000
Newsgroups gmane.comp.web.dom.general
Message-ID <[email protected]>
ArkadiuszMichalski has just created a new issue for =

https://github.com/whatwg/dom:

=3D=3D Behaviour for pointerBeforeReferenceNode when all nodes do not pass
 filtration =3D=3D
Traverse algo doesn't fit to Firefox/Chrome behaviour when we skip all
 nodes and try invoke NodeIterator.nextNode(). Per algo true should be
 change to false, but this browsers still keep true.

<script>

        var iterator =3D document.createNodeIterator(document, 0);
        alert(iterator.pointerBeforeReferenceNode); // true
        iterator.nextNode();
        alert(iterator.pointerBeforeReferenceNode); // true

</script>

Others edge case may by interesting, like removing referenceNode where
 some other node must be as referenceNode (even if not acceptable by =

filter), so  NodeIterator.nextNode()/NodeIterator.previousNode() =

should only change pointerBeforeReferenceNode or not?

 I don't know what Edge does, but IE11  still doesn't support =

pointerBeforeReferenceNode and referenceNode attributes.

Of course browsers can follow with these new guidelines if it's not =

compatibility problem and bring some simplification, or just fix this =

algo to fit actual browsers behaviour.

And a few comments on this algorithm (all for 3.1 step):
- "If direction..." direction is passing argument, then can be treat =

as variable =

- iterator collection was defined so use reference. BTW, it's =

collection (rooted at root, whose filter matches any node), but for =

iterator sense root should not be included to this collection (as =

first element)?
- having three /if/ conditions writing in one line (separate by dot) =

is quite readable, especially when first cooperate with second, and =

third is opposite to first. Something like we have here =

http://www.w3.org/TR/dom/#concept-nodeiterator-traverse is better.

See https://github.com/whatwg/dom/issues/87