Re: Mutation events replacement

On Thu, Jun 4, 2009 at 4:46 AM, mozer <xmlizer@gmail.com> wrote:
>
>
> On Thu, Jun 4, 2009 at 1:42 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>>
>> On Thu, Jun 4, 2009 at 4:37 AM, mozer <xmlizer@gmail.com> wrote:
>> >
>> >
>> > On Thu, Jun 4, 2009 at 12:07 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>> >>
>> >> Here's an API that might work:
>> >>
>> >> The following methods are added to the Document, Element and
>> >> DocumentFragment interfaces:
>> >>
>> >>  addAttributeChangedListener(NodeDataCallback);
>> >>  addSubtreeAttributeChangedListener(NodeDataCallback);
>> >>  addChildlistChangedListener(NodeDataCallback);
>> >>  addSubtreeChangedListener(NodeDataCallback);
>> >
>> > I would go for
>> > addSubtreeElementChangedListener for this one since a modification to an
>> > attribute in the subtree does not trigger it
>>
>> the 'SubtreeAttributeChanged' callbacks are called whenever an
>> attribute is the subtree below the node where the callback is
>> registered is changed. Is that not what you need? I.e. in a DOM like
>>
>> <body>
>>  <div>
>>    <p>
>>      here's some text
>>    </p>
>>  </div>
>> </body>
>>
>> If I call  div.addSubtreeAttributeChangedListener(doStuff);
>>
>> then doStuff is called if someone sets an attribute on the <p> element.
>
> We're in agreement here !
> That's why I would go for a name stating explicitly that it is about ELEMENT
> in the subtree and not Whatever in the subtree

Ah, now I understand what you're suggesting. I think "ElementChanged"
could mean more than attribute changes though, such as children added
or removed.

I'll leave debates for things like names for later though, until
there's agreement that this is the general API we want to go for.

/ Jonas

Received on Thursday, 4 June 2009 11:50:00 UTC