Bug 119325
Summary: | compareDocumentPosition() reports an attribute and its content as disconnected | ||
---|---|---|---|
Product: | WebKit | Reporter: | Chris Dumez <cdumez> |
Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | ahmad.saleem792, annevk, ap, darin, rniwa |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Chris Dumez
Node::compareDocumentPosition() reports an attribute and its content as disconnected.
Instead, the attribute should contain and precede its content.
This is causing the following test case to fail:
LayoutTests/dom/xhtml/level3/core/nodecomparedocumentposition38.xhtml
I investigated the issue a bit and it seems the problem seems to be that Node::inDocument() returns false for the Text node (content) instead of true.
Note that there is already a workaround in place in Node::compareDocumentPositionInternal() that addresses the same issue for Attribute nodes.
See comment in that method:
// Note that we avoid comparing Attr nodes here, since they return false from inDocument() all the time (which seems like a bug).
It is likely we need to extend the workaround to Text nodes or fix the underlying problem (have inDocument() return correct values for Attr and Text nodes).
Specification:
http://dom.spec.whatwg.org/#dom-node-comparedocumentposition
Corresponding Blink bug:
http://code.google.com/p/chromium/issues/detail?id=264138
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Chris Dumez
As explained by Adam in http://code.google.com/p/chromium/issues/detail?id=264138#c1, Attr should no longer be a Node according to the latest specification. It should be its own interface [1].
If we followed the spec, the bug would disappear.
[1] http://dom.spec.whatwg.org/#attr
Ahmad Saleem
Safari is passing all WPT tests:
https://wpt.fyi/results/dom/nodes/Node-compareDocumentPosition.html?label=master&label=experimental&aligned=
Chris - Do we need to anything here?
Ryosuke Niwa
Looks like this bug has been fixed by now.