DOMSubtreeModified

Hi Boris,

  I remember you said somewhere the definition of DOMSubtreeModified is
not sufficiently clear as to when the event is to occur, though I could
not find where you said that. Could you have a look at the latest draft
<http://www.w3.org/TR/DOM-Level-3-Events> and tell me whether you still
find the definition unclear and possibly explain why and propose changes
that would address your concern?

My understanding is as follows: you have a subtree and it is mutated in
some way; the individual mutation events occur, and then, at some imple-
mentation defined point, DOMSubtreeModified occurs. If the subtree is
not mutated, the event does not occur. The expectation is that the event
occurs in a way that allows authors of DOM applications to react to the
DOMSubtreeModified event only.

As an example, you have an SVG document with a <g> group and some child
elements. You want to draw a border around all elements in the group, so
you register a DOMSubtreeModified listener on the <g> that updates the
border so it is drawn around all child elements even if the children
change position, dimensions, or as children are removed or added. The
alternative would be to register DOMAttrModified, DOMNodeInserted, and
other listeners on the group, and check whether an update is needed (or
update directly) each time, which would make the code considerably more
complex and slower.

Thanks,
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Monday, 8 May 2006 23:25:36 UTC