- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Wed, 26 Nov 2008 17:19:17 -0500
- 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 parser's). 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. -Boris
Received on Wednesday, 26 November 2008 22:26:19 UTC