Re: Mutation events replacement

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


>
>
> >> And when Text/CDATASection/ProcessingInstruction
> >
> > Please add "Comment" too
>
> Yup.
>
> / Jonas
>

Xmlizer

Received on Thursday, 4 June 2009 11:46:39 UTC