[whatwg] More HTML Editing Commands questions

On Thu, May 19, 2011 at 1:10 PM, Aryeh Gregor <Simetrical+w3c at gmail.com>wrote:
>
>  > What I have in mind doesn't involve DOM mutation. Imagine the
> > selection is collapsed in the middle of a text node and the bold
> > command is called. The browser now has an internal flag set but there
> > is no change in the DOM. However, if the selection is moved away from
> > its current position, that flag is unset and that position is no
> > longer notionally bold, even if the selection is then returned to its
> > original position before anything else happens. This happens in all
> > browsers. To achieve this with JavaScript running in the page, you
> > need a reliable selection change event. For the purposes of simply
> > tracking the user moving the selection, an asynchronous event would be
> > fine.
>
> Assuming that your goal here is to replicate execCommand() from
> JavaScript, what happens if the user puts the selection somewhere,
> bolds, types something, then moves the selection elsewhere?


selectionchange event should fire after each user action unless those user
actions are simulated by scripts.

I guess that works fine if there are reliable input events (are there?), and
> they're ordered properly with respect to the selection change events.
>

Right.

- Ryosuke

Received on Thursday, 19 May 2011 13:19:20 UTC