On Thu, Jun 4, 2009 at 1:42 PM, Jonas Sicking <jo...@sicking.cc> wrote:
> On Thu, Jun 4, 2009 at 4:37 AM, mozer <xmli...@gmail.com> wrote: > > > > > > On Thu, Jun 4, 2009 at 12:07 PM, Jonas Sicking <jo...@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