[Webkit-unassigned] [Bug 103599] New: Node::compareDocumentPosition should return either FOLLOWING OR PRECEDING for nodes which are not in the same tree.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Nov 28 21:13:11 PST 2012
https://bugs.webkit.org/show_bug.cgi?id=103599
Summary: Node::compareDocumentPosition should return either
FOLLOWING OR PRECEDING for nodes which are not in the
same tree.
Product: WebKit
Version: 528+ (Nightly build)
Platform: Unspecified
OS/Version: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: HTML DOM
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: hayato at chromium.org
CC: tasak at google.com, webcomponents-bugzilla at chromium.org
Blocks: 72352
According to the spec (http://dom.spec.whatwg.org/#dom-node-document_position_disconnected):
> If other and reference are not in the same tree, return the result of adding DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, and either DOCUMENT_POSITION_PRECEDING or DOCUMENT_POSITION_FOLLOWING, with the constraint that this is to be consistent, together and terminate these steps.
> Whether to return DOCUMENT_POSITION_PRECEDING or DOCUMENT_POSITION_FOLLOWING is typically implemented via pointer comparison. In JavaScript implementations Math.random() can be used.
We should return the value which has either DOCUMENT_POSITION_PRECEDING or DOCUMENT_POSITION_FOLLOWING flag with the constraint to be consistent.
Since Node.compareDocumentPosition is a web facing API, we should be careful about whether it's okay to add flag to the return value.
If users checks the return value using bitwise operation (e.g if ((return value & Node.DOCUMENT_POSITION_DISCONNECTED) != 0)), it's okay. But I am afraid most users don't do that.
I am adding tasak@ to cc since he needs a kind of total order for nodes in the different shadow tree.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list