W3C home > Mailing lists > Public > public-html@w3.org > November 2008

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 26 Nov 2008 17:19:17 -0500
Message-ID: <492DCB65.7000206@mit.edu>
To: Henri Sivonen <hsivonen@iki.fi>, HTML WG <public-html@w3.org>

Henri Sivonen wrote:
> Why is there even a need for parsing into a document fragment?

In Gecko's case, because there is an existing (and used) API that hands 
back document fragments...  So that needs to be supported, though it 
could just share code with innerHTML instead of innerHTML being 
implemented in terms of createContextualFragment as now.  That said,

> Would mutation events or something of that nature go wrong if parsing directly 
> into the context node?

Well, they'd fire as you insert nodes, yes.  Right now by the time that 
happens the parser is done and we're just in the already-solved case of 
inserting a document fragment into a document.  So there are just fewer 
codepaths, from the DOM point of view (though possibly more from the 

This is all Gecko implementation details, though (as is the fact that I 
think we can make the document fragment case faster than the other).

 From a spec point of view the only obvious issue I see here is that the 
mutation event behavior means the parser needs to take pains to produce 
the same results as would be produced by the currently-specified 
algorithm even in cases when mutation events rearrange the DOM.

Received on Wednesday, 26 November 2008 22:26:19 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:39 UTC