- From: <bugzilla@jessica.w3.org>
- Date: Tue, 30 Oct 2012 12:08:57 +0000
- To: public-webapps-bugzilla@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=19555 --- Comment #4 from Aryeh Gregor <ayg@aryeh.name> --- It's always possible to implement this feature by picking a random result when needed and then remembering it for future calls. In JS, you could do this for nodeA.compareDocumentPosition(nodeB): var rootA = nodeA; while (rootA.parentNode) { rootA = rootA.parentNode; } var rootB = nodeB; while (rootB.parentNode) { rootB = rootB.parentNode; } if (rootA != rootB) { if (rootA.randomValue === undefined) { rootA.randomValue = Math.random(); } if (rootB.randomValue === undefined) { rootB.randomValue = Math.random(); } return Node.NODE_DOCUMENT_POSITION_DISCONNECTED | Node.NODE_DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | (rootA.randomValue < rootB.randomValue ? Node.DOCUMENT_POSITION_PRECEDING : Node.DOCUMENT_POSITION_FOLLOWING); } // Same-root case, not relevant here This would in practice probably not be impractically expensive, and I believe it meets the spec (unless Math.random() returns the same value twice). -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Tuesday, 30 October 2012 12:09:05 UTC