You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Gerd Mueller <ge...@softwarebuero.de> on 2000/03/17 14:20:05 UTC

Mutation Events

Hi,

I've got a question regarding the mutation events: 

I write an application which needs to be notified about _any_ mutation of a
DOM tree and I think the DOM event model is suitable to handle this (?). 

But if I understand the specification and the implementation of Xerces right I
have to add event listeners for _each_ mutation event type to _every_ node of
the tree to be notified of any mutation - is this right ? 

It seems to me a big wast of ressources. Wouldn't it be more clever to have
the possibility to add one event listener for each event type to the root node
and catch there all events which may happen somewhere in the DOM tree ? But I'm
not sure if this is W3C conform. 

Or is there another solution for this problem ?

Best Regards,
Gerd

-- 
________________________________________________________________
Gerd Mueller                               gerd@softwarebuero.de
softwarebuero m&b                    http://www.softwarebuero.de


Re: Mutation Events

Posted by Gerd Mueller <ge...@softwarebuero.de>.
Hi,

> Events in the DOM can "bubble" up the tree. Section 6.2.3 of the
> candidate recommendation specification describes how this works.
> But the important thing is that you only have to register your
> listener on the root and not on *every* node.
> 
> Section 6.6.4 from the specification tells you which MutationEvents
> bubble up the tree. Some don't. For the others, you should be able
> to register your event listener on the root of the tree and receive
> the notification.
> 
> If our implementation doesn't behave the way that the spec details,
> then we need to know so that it can be fixed by someone. For more
> information on DOM Level 2 events, check out the specification at
> the following link: http://www.w3.org/TR/DOM-Level-2/events.html

Thank you, it works now. Probably my example was somehow 'miscontructed'.

Regards
Gerd

-- 
________________________________________________________________
Gerd Mueller                               gerd@softwarebuero.de
softwarebuero m&b                    http://www.softwarebuero.de


Re: Mutation Events

Posted by Andy Clark <an...@apache.org>.
Gerd Mueller wrote:
> But if I understand the specification and the implementation of Xerces right I
> have to add event listeners for _each_ mutation event type to _every_ node of
> the tree to be notified of any mutation - is this right ?

Events in the DOM can "bubble" up the tree. Section 6.2.3 of the
candidate recommendation specification describes how this works.
But the important thing is that you only have to register your
listener on the root and not on *every* node.

Section 6.6.4 from the specification tells you which MutationEvents
bubble up the tree. Some don't. For the others, you should be able
to register your event listener on the root of the tree and receive
the notification.

If our implementation doesn't behave the way that the spec details,
then we need to know so that it can be fixed by someone. For more
information on DOM Level 2 events, check out the specification at
the following link: http://www.w3.org/TR/DOM-Level-2/events.html

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org