W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2008

Re: [D3E] Possible Changes to Mutation Events

From: Stewart Brodie <stewart.brodie@antplc.com>
Date: Wed, 16 Jul 2008 10:02:23 +0100
To: public-webapps@w3.org
Message-ID: <84d2d3f0de4fc7e16456679657b5d69a8f06d06a@localhost>

Boris Zbarsky <bzbarsky@MIT.EDU> wrote:

> Doug Schepers wrote:
> >> 2) If DOMNodeRemoved is fired after the mutation, event won't be 
> >> capable of bubbling
> > 
> > I don't believe that is correct.  DOM3 Event states:
> > 
> > "At the beginning of the dispatch, implementations must first determine 
> > the event object's propagation path.
> I think Sergey's point was that if dispatch happens after the removal, 
> and the target is the node being removed, this path will have nothing else
> in it.

It may be possible to pre-compute the list, but that would certainly
complicate the code that implements event dispatch, and as all of a sudden
we would have two events that needs to behave differently in some cases -
because, of course, you wouldn't want to modify the tree if the event was
dispatched via dispatchEvent()

Specifying the order would be the most helpful that could be done for these
two events.  For removal, I dispatch DOMNodeRemoved first and then do a
post-order traversal issuing DOMNodeRemovedFromDocument.  For insertion, I
dispatch DOMNodeInserted first and then do a pre-order traversal issuing
DOMNodeInsertedIntoDocument.  IIRC, this was consistent with Firefox and
Opera at the time and it seems sensible enough.

Stewart Brodie
Software Engineer
ANT Software Limited
Received on Wednesday, 16 July 2008 09:03:04 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:11 UTC