Bug 44598 - DOM Selection: collapseToStart() and collapseToEnd() should throw INVALID_STATE_ERR if there's no selection
Summary: DOM Selection: collapseToStart() and collapseToEnd() should throw INVALID_STA...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: HTML5
Depends on:
Blocks:
 
Reported: 2010-08-25 03:39 PDT by Andreas Kling
Modified: 2010-09-01 03:23 PDT (History)
1 user (show)

See Also:


Attachments
Proposed patch (6.58 KB, patch)
2010-08-25 03:42 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2010-08-25 03:39:03 PDT
Selection.collapseToStart() and Selection.collapseToEnd() should throw INVALID_STATE_ERR if no selection is made.

This would cause us to pass the following test on IE Test Center:
http://samples.msdn.microsoft.com/ietestcenter/html5/selection/emptyselection_invalidStateErr.htm

Spec links:
http://www.whatwg.org/specs/web-apps/current-work/#dom-selection-collapsetostart
http://www.whatwg.org/specs/web-apps/current-work/#dom-selection-collapsetoend
Comment 1 Andreas Kling 2010-08-25 03:42:31 PDT
Created attachment 65396 [details]
Proposed patch
Comment 2 Alexey Proskuryakov 2010-08-25 09:57:03 PDT
Do these raise an exception in Firefox?

Raising exceptions where we didn't use to can be a significant compatibility issue, because if any page depended on the old behavior, it often stops working completely.
Comment 3 Andreas Kling 2010-08-25 10:03:02 PDT
(In reply to comment #2)
> Do these raise an exception in Firefox?

No, only IE9 implements this behavior so far AFAIK.
Comment 4 Andreas Kling 2010-09-01 03:23:30 PDT
Comment on attachment 65396 [details]
Proposed patch

Clearing flags on attachment: 65396

Committed r66590: <http://trac.webkit.org/changeset/66590>
Comment 5 Andreas Kling 2010-09-01 03:23:40 PDT
All reviewed patches have been landed.  Closing bug.