W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2009

Re: HTML5 dependencies on DOM3 Events

From: Maciej Stachowiak <mjs@apple.com>
Date: Thu, 04 Jun 2009 03:37:34 -0700
Cc: Doug Schepers <schepers@w3.org>, Ian Hickson <ian@hixie.ch>, www-dom@w3.org, Daniel Danilatos <danilatos@google.com>
Message-id: <33C60E5D-7353-4629-8478-41CF51747E7B@apple.com>
To: Ojan Vafai <ojan@chromium.org>

On Jun 3, 2009, at 2:34 AM, Ojan Vafai wrote:

> On Wed, Jun 3, 2009 at 5:59 PM, Doug Schepers <schepers@w3.org> wrote:
> Ian Hickson wrote (on 6/1/09 7:37 PM):
> HTML5 has the following dependencies on DOM3 Events:
>
> * Mutation events
>   There are a number of parts of HTML5 where what HTML5 should say  
> depends
>   on what happens with mutation events in DOM3 Events. (My preference
>   would be for mutation events to be either replaced wholesale or made
>   asynchronous, so that they are queued on the event loop instead of  
> being
>   fired as the changes happen, since the latter can result in serious
>   complexities and makes it very hard to maintain invariants during  
> the
>   execution of algorithms.)
>
> I also prefer this, but have heard that it breaks some existing  
> code, and doesn't do what some authors want.  I'll to to come to  
> consensus on the best option here.

The way mutation events work now makes all core DOM operations slower  
and more fragile if you implement it. I'm curious what existing code  
is broken.

>
> I wonder how many of the cases of what authors want would be better  
> served by higher-level APIs. For example, Google Wave is a very  
> heavy user of mutation events to track user input. But they use  
> mutation events because they happen to be the only thing that  
> captures all text input that users make. In practice, mutation  
> events are too noisy and too low-level for their needs, but they  
> serve as a catchall. They'd much rather have something that  
> expresses higher-level actions.
>
> For example, one idea we came up with for their use case is having  
> something like a cancellable onExecCommand event that would fire  
> whenever an execCommand was called and to spec it such that all text  
> editing is required to go through an execCommand (e.g. undo, redo,  
> insertText, bold, etc). These are much higher-level and less noisy  
> than mutation events and wouldn't have a number of problems that  
> mutation events do (e.g. performance penalties, crashiness  
> complexities, etc).

I'm not sure it makes sense to mandate that user typing or other  
direct manipulation (say, dragging a selection) acts as if execCommand  
had been invoked. I think it may make more sense to have an event  
similar to HTML5's oninput on <input elements> also available on  
contentEditable regions. That's pretty abstract, so it doesn't have to  
be tied to execCommand, but it can be spec'd to fire whenever the  
contents change for any user-initiated reason, with the option to  
coalesce for changes in rapid succession.

Regards,
Maciej
Received on Thursday, 4 June 2009 10:38:14 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:00 GMT