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

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

From: Jonas Sicking <jonas@sicking.cc>
Date: Wed, 26 Nov 2008 13:28:45 -0800
Message-ID: <492DBF8D.3070904@sicking.cc>
To: Henri Sivonen <hsivonen@iki.fi>
CC: HTML WG <public-html@w3.org>

Henri Sivonen wrote:
> 
> I'm considering implementing HTML5 innerHTML setting in Gecko by using 
> the owner document of the context node as the document seen by the 
> parser and by sticking the context node as the first node on the stack 
> (but masking its name to show "html" to the tree builder in order to 
> avoid breaking the fragment algorithm assertions) and by then running 
> the fragment parsing algorithm without returning to the event loop until 
> done. The context node would be in the tree for the entire time. I'd 
> deflect attempts to add more attributes to the root node upon stray 
> <html> tag.
> 
> Is there a reason why the spec doesn't prescribe this? Why does the spec 
> specify parsing into another document first and then moving the nodes 
> over? Is what I described above not black-box equivalent to the steps 
> that the spec prescribes?

What do you mean by "masking its name to show 'html'"?

In general, looking at the innerHTML parsing algorithm, it seems like we 
should try to make it faster. Setting innerHTML is a very performance 
critical operation in many webapps so we definitely don't want to 
require things like creating new documents.

Why couldn't the spec instead say to use the ownerDocument of the 
context node (like Henri is suggesting) and parse into a 
documentFragment node? I.e. why do we need the new Document node and the 
new <html> node?

/ Jonas
Received on Wednesday, 26 November 2008 21:27:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:27 GMT