Re: Black-box equivalence of parsing fragments directly into context node

Henri Sivonen wrote:
>> Well, they'd fire as you insert nodes, yes.
> 
> Do you mean when the parser inserts node or when a document fragment is 
> inserted into the context node?

Both, in theory, but if the parser is parsing into an isolated document 
fragment there won't be any mutation listeners set up anywhere around 
that yet.

> I'm doing things like aParent->AppendChildTo(aChild, PR_TRUE); with the 
> assumption that this notifies but doesn't fire a mutation event. Now 
> that I've looking further in the code, I'm suspecting the two might be 
> coupled...

In Gecko, they are.

> Are different browsers consistent in what mutation events they fire in 
> this case?

I don't know (though I would suspect they aren't, on general principle).

> Can mutation event listeners do any kind of mischief before there has 
> been an event loop spin?

Mutation events fire synchronously, yes.  They have to, per DOM spec.

-Boris

Received on Thursday, 27 November 2008 15:16:24 UTC