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

Re: Mutation events replacement

From: Ryosuke Niwa <rniwa@webkit.org>
Date: Wed, 6 Jul 2011 08:52:46 -0700
Message-ID: <CABNRm60mDRhAoFf9LOGAcw9Kn1g7VPUfCqLS9DevCKqdXgzQYA@mail.gmail.com>
To: Dave Raggett <dsr@w3.org>
Cc: Olli@pettay.fi, Olli Pettay <Olli.Pettay@helsinki.fi>, Ojan Vafai <ojan@chromium.org>, Boris Zbarsky <bzbarsky@mit.edu>, public-webapps@w3.org
On Wed, Jul 6, 2011 at 1:27 AM, Dave Raggett <dsr@w3.org> wrote:

> On 04/07/11 21:43, Olli Pettay wrote:
>>
>> In the easiest case when the script cares about only one specific
>> attribute:
>> element.**addAttributeChangeListener(
>>  {
>>    prevVal: element.getAttribute("foo"),
>>    handleMutation: function(node, changeTarget) {
>>      if (node == changeTarget) {
>>        // do something with this.prevVal
>>        ...
>>        this.prevVal = element.getAttribute("foo");
>>      }
>>    }
>>  });
>>
>
> How does that scale to the case where you set the observer on the document
> or on a div element acting as a contained for content editable content?  If
> I am not mistaken you would have to keep a copy of the document, or of that
> div element respectively, and keep it in sync with all of the mutations,
> which sounds like a major performance hit, and something you don't need to
> incur with the current DOM mutation events.


We should probably include the old value optionally.

- Ryosuke
Received on Wednesday, 6 July 2011 15:53:33 GMT

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