[whatwg] Selection events in editable content
Ryosuke Niwa
rniwa at webkit.org
Tue May 10 08:42:26 PDT 2011
On Tue, May 10, 2011 at 8:33 AM, Ojan Vafai <ojan at chromium.org> wrote:
> On Mon, May 9, 2011 at 9:05 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
>>
>> One question about selectstart. WebKit currently fires whenever selection
>> is modified by a mouse drag, mouse click, etc... including when a
>> collapsed
>> selection is to be set (caret / insertion point). Should this be changed
>> to
>> match IE?
>>
>> IE only fires selectstart when a range selection is to be created. So when
>> a
>> user clicks on a contenteditable area and puts a caret, it doesn't fire
>> selectstart. IE fires selectstart only when a user starts dragging the
>> mouse
>> and extend the selection.
>>
>
> What's the difference between selectstart and selectionchange in WebKit? In
> IE is this case the only difference between the two?
>
selectstart fires before selection changes, it bubbles, and it's cancelable.
So it's very useful if you want to prevent selection. But the event isn't
useful as much as it could be because it doesn't tell you what new selection
is so we might want to consider adding new property like newSelectionRanges
that tells you what new selection will be.
- Ryosuke
More information about the whatwg
mailing list