[Bug 26005] Selection.extend behavior when there is no range needs to be clarified

https://www.w3.org/Bugs/Public/show_bug.cgi?id=26005

Ryosuke Niwa <rniwa@webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #3 from Ryosuke Niwa <rniwa@webkit.org> ---
(In reply to Ben Peters from comment #0)
> 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.

This is taken care of by the first step in its definition:

"If the context object is empty, throw an InvalidStateError exception and abort
these steps."

since the definition of "empty" is

"Each selection can be associated with a single range (defined in [DOM4]). When
there is no range associated with the selection, the selection is empty. The
selection must be initially empty."

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Tuesday, 16 September 2014 01:18:59 UTC