Bug 149490

Summary: Range's setStartBefore() / setStartAfter() / setEndBefore() / setEndAfter() do not match the specification
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin, esprehn+autocc, kangil.han, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar, WebExposed
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Chris Dumez 2015-09-22 20:51:57 PDT
Range's setStartBefore() / setStartAfter() / setEndBefore() / setEndAfter() do not match the specification:
- https://dom.spec.whatwg.org/#dom-range-setstartbefore
- https://dom.spec.whatwg.org/#dom-range-setstartafter
- https://dom.spec.whatwg.org/#dom-range-setendbefore
- https://dom.spec.whatwg.org/#dom-range-setendafter

In particular, instead of step 2:
"If parent is null, throw an InvalidNodeTypeError exception."

Our implementation does more checks and throws exceptions in cases that the specification does not say we should.

Firefox's behavior matches the specification.
Comment 1 Chris Dumez 2015-09-22 20:58:47 PDT
Created attachment 261792 [details]
Patch
Comment 2 Andreas Kling 2015-09-23 04:27:30 PDT
Comment on attachment 261792 [details]
Patch

r=me
Comment 3 WebKit Commit Bot 2015-09-23 09:21:54 PDT
Comment on attachment 261792 [details]
Patch

Clearing flags on attachment: 261792

Committed r190174: <http://trac.webkit.org/changeset/190174>
Comment 4 WebKit Commit Bot 2015-09-23 09:21:59 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Chris Dumez 2015-09-24 16:58:59 PDT
*** Bug 148767 has been marked as a duplicate of this bug. ***
Comment 6 Radar WebKit Bug Importer 2015-09-28 11:41:09 PDT
<rdar://problem/22882522>