[whatwg] Selection events in editable content

Ryosuke Niwa rniwa at webkit.org
Fri May 6 09:11:17 PDT 2011


On Fri, May 6, 2011 at 8:55 AM, Tim Down <timdown at gmail.com> wrote:

> Are there any plans for selection-related events for editable HTML
> content (contenteditable or designMode)? An event that fires whenever
> the selection changes would be very useful and seems a curious
> oversight in most current browsers. The current situation is:
>

I have recently implemented WebKit's selectionchange
event<http://trac.webkit.org/changeset/79208>.
WebKit's implementation is slightly different from that of Internet Explorer
in that the event fires asynchronously but should still be useful in many
cases.

At some point in the future, I'd like to standardize selectionchange event.

However, no event is fired in WebKit when  the
> user chooses "Select all" from the edit or context menus, or presses
> Ctrl/Cmd-A.
>

That sounds like a bug. Please file a bug <http://bugs.webkit.org/>.


> IE is the only major browser that has seriously useful behaviour here.
> Are there any plans to spec this or similar behaviour? I can think of
> several use cases within the context of a rich text editor if
> justification is required.
>

One of the challenges we face as implementors is when selection changes due
to DOM mutations (via JavaScript, editing, etc...).  Because of the way
selection is updated in WebKit, introducing new synchronous event or firing
selectstart/select in new places will be quite tricky for us.

Best,
Ryosuke Niwa
Software Engineer
Google Inc.



More information about the whatwg mailing list