Bug 148774 - Range.intersectsNode() does not behave according to the specification when start / end are equal
Summary: Range.intersectsNode() does not behave according to the specification when st...
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://dom.spec.whatwg.org/#dom-rang...
Keywords: InRadar, WebExposed
Depends on:
Reported: 2015-09-03 19:30 PDT by Ryosuke Niwa
Modified: 2015-09-22 15:27 PDT (History)
5 users (show)

See Also:

Patch (5.47 KB, patch)
2015-09-22 12:42 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2015-09-03 19:30:52 PDT
When the range is "detached", (i.e. start/end are never set), Range.intersectNode should return false on DocType.

This is what Firefox does. See https://dom.spec.whatwg.org/#dom-range-intersectsnode
Comment 1 Radar WebKit Bug Importer 2015-09-03 19:31:16 PDT
Comment 2 Chris Dumez 2015-09-21 11:01:12 PDT
Ryosuke, what do you mean by detached range? It is impossible to detach a range as Range.detach() is a no-op. Also, which test is failing because of this (the bug doesn't say)?
Comment 3 Ryosuke Niwa 2015-09-21 12:04:39 PDT
I mean that when neither start nor end is set.
Comment 4 Chris Dumez 2015-09-21 12:24:28 PDT
(In reply to comment #3)
> I mean that when neither start nor end is set.

start and end are set to be the ownerDocument when the Range is constructed AFAIK.
Comment 5 Chris Dumez 2015-09-22 10:36:46 PDT
Failing test: imported/w3c/web-platform-tests/dom/ranges/Range-intersectsNode.html
"Node 20 doctype, detached range" check.
Comment 6 Chris Dumez 2015-09-22 10:57:55 PDT
FYI, I am still trying to figure out what we're doing wrong.

Range is constructed so we initialize its start / end to be the context document, as per the spec:

Then it calls intersectsNodes(docType) and we return true, but the test expects false.
Comment 7 Chris Dumez 2015-09-22 12:42:21 PDT
Created attachment 261762 [details]
Comment 8 WebKit Commit Bot 2015-09-22 15:27:46 PDT
Comment on attachment 261762 [details]

Clearing flags on attachment: 261762

Committed r190136: <http://trac.webkit.org/changeset/190136>
Comment 9 WebKit Commit Bot 2015-09-22 15:27:52 PDT
All reviewed patches have been landed.  Closing bug.