Re: [selection] extend() behavior when there is no range needs to be clarified

It's probably a bug in WebKit/Blink. Since we're already throwing other exceptions in some cases (e.g. INDEX_SIZE_ERR), we can probably change our engine behavior.

yoshin: any opinions for blink?

On Jun 6, 2014, at 11:31 AM, Ben Peters <> wrote:

> I just filed this bug. Do we know of reasons why Chrome (Webkit?) doesn't throw an exception for this scenario? It seems confusing to web devs.
> Ben
>> -----Original Message-----
>> From: []
>>            Bug ID: 26005
>>           Summary: Selection.extend behavior when there is no range needs
>>                    to be clarified
>>           Product: WebAppsWG
>>           Version: unspecified
>>          Hardware: PC
>>                OS: Windows NT
>>            Status: NEW
>>          Severity: normal
>>          Priority: P2
>>         Component: Selection API
>>          Assignee:
>>          Reporter:
>>        QA Contact:
>>                CC:,
>> Today, the Selection API spec seems to say that if selection.rangeCount is 0,
>> then selection.extend should throw an error and abort. This is true in Firefox,
>> but not Chrome. In Chrome, it appears that a new collapsed range is created
>> at the position specified in selection.extend. Without an error, it's possible a
>> site might end up creating a selection when they think they're extending it.
>> But errors in JS should be used sparingly. Not sure which of these makes
>> more sense.
>> --
>> You are receiving this mail because:
>> You are on the CC list for the bug.

Received on Friday, 6 June 2014 20:22:45 UTC