RESOLVED WONTFIX 33510
selection.modify() should throw an exception if the selection does not have a range or is detached
https://bugs.webkit.org/show_bug.cgi?id=33510
Summary selection.modify() should throw an exception if the selection does not have a...
Justin Lebar
Reported 2010-01-11 19:56:11 PST
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
Mats Palmgren
Comment 1 2010-01-11 20:20:14 PST
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
Comment 2 2010-01-11 20:59:29 PST
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
Comment 3 2010-10-27 23:19:35 PDT
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
Comment 4 2010-10-27 23:52:47 PDT
FYI, Bug 33509 had similar discussion and concludes not to throw an exception.
Ryosuke Niwa
Comment 5 2010-10-27 23:55:48 PDT
(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
Comment 6 2010-10-27 23:56:04 PDT
Oops, I meant wontfix.
Justin Lebar
Comment 7 2010-10-28 01:29:25 PDT
(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.
Note You need to log in before you can comment on or make changes to this bug.