W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Re: Mutation events replacement

From: Ryosuke Niwa <rniwa@webkit.org>
Date: Tue, 19 Jul 2011 18:06:30 -0700
Message-ID: <CABNRm609YCb_4Yq_A7ydF9NWkAz9z5453PZy5c7HYjtMAfi8Kw@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: Rafael Weinstein <rafaelw@google.com>, Olli@pettay.fi, Aryeh Gregor <Simetrical+w3c@gmail.com>, Adam Klein <adamk@google.com>, Anne van Kesteren <annevk@opera.com>, Webapps WG <public-webapps@w3.org>
On Tue, Jul 19, 2011 at 4:56 PM, Jonas Sicking <jonas@sicking.cc> wrote:

> On Tue, Jul 19, 2011 at 4:18 PM, Ryosuke Niwa <rniwa@webkit.org> wrote:
> > For editing purposes, it's also crucial to know from/to where nodes are
> > removed/inserted.  It seems like adding an offset trivially solves this
> > problem without much overhead.
>
> I'm not really sure how you're expecting to use indexes. Not that once
> one node is removed, the index changes for all other nodes. Can you
> provide a short example code demonstrating how you'd use the index?


But if you have the full list of mutations that had happened, you should be
able to infer exactly where nodes and inserted and removed.  I'm thinking of
cases where collaborative editing app and so forth needs to sync data with a
remote server.  In that case, the script wants to figure out what inserted
or removed where.

>> * For "characterdata" you don't get the old or new value of the node.
> >> We could also simply add the before/after values here as there
> >> shouldn't be as much serialization overhead involved.
> >
> > For editing purposes, seeing old and new value is essential.
>
> As has been previously mentioned, providing the old value comes with
> significant overhead. For your usecase it seems like this is overhead
> that you'll need to live with, but for many others it might not be.
>

Agreed.

We could solve this by making it configurable if you want the old
> values or not. For example by having separate notification types that
> contain before and after values.
>
> Though note that providing the after-values rarely seems useful as you
> can simply get them as needed from the DOM. As for childlists, the
> only sane solution I can think of would be to provide what the whole
> childlist looked like before modifications started.
>

Yeah, that sounds like a reasonable approach here.  I'll think about use
cases where we want after-value.

I'm kind of guessing what editor authors want to have from my limited
experience getting feedbacks from them but I'll contact folks I know and see
if I can get more concrete use cases.

- Ryosuke
Received on Wednesday, 20 July 2011 01:07:20 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:46 GMT