Bug 33510
| Summary: | selection.modify() should throw an exception if the selection does not have a range or is detached | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Justin Lebar <justin.lebar+bug> |
| Component: | HTML Editing | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED WONTFIX | ||
| Severity: | Normal | CC: | ap, ishermandom+bugs, justin.lebar+bug, matspal, mitz, morrita, ojan, rniwa |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | All | ||
| OS: | All | ||
Justin Lebar
If we call selection.removeAllRanges() or selection.getRangeAt(0).detach(), then perhaps selection.modify() should throw an exception, indicating that there's no selection to modify. selection.modify() currently silently fails in this case.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Mats Palmgren
DOMException INVALID_STATE_ERR is used in HTML5 Selection
when there's something wrong with the selection range:
http://www.whatwg.org/specs/web-apps/current-work/#selection-0
and in DOM-Level-2-Traversal-Range when using a detached range:
http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-idl
so INVALID_STATE_ERR seems like the appropriate exception to use here.
Alexey Proskuryakov
I don't think we should do that. There is a significant chance that raising an exception where we didn't do that previously will break some pages - and the potential benefit is extremely minor.
Ryosuke Niwa
I agree with Alexey. Throwing an exception at this point will break existing web pages. Does Firefox 4 throws an exception in such cases?
Hajime Morrita
FYI, Bug 33509 had similar discussion and concludes not to throw an exception.
Ryosuke Niwa
(In reply to comment #4)
> FYI, Bug 33509 had similar discussion and concludes not to throw an exception.
Ok. We should close these bugs as invalid.
Ryosuke Niwa
Oops, I meant wontfix.
Justin Lebar
(In reply to comment #3)
> I agree with Alexey. Throwing an exception at this point will break existing web pages. Does Firefox 4 throws an exception in such cases?
We silently fail. +1 on the WONTFIX.