This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
http://lists.w3.org/Archives/Public/public-webapps/2011OctDec/0663.html
Created attachment 1042 [details] Adds an "unknown context" insertion mode, that would be used when using innerHTML= on a document fragment
We first need to add the insertion mode to the HTML parser, then it can be used in DOM Parsing.
Anne, this is a bug for my own tracking purposes. Please file another bug on HTML if you need one.
For those interested, I am working on this as part of the HTML templates spec. See a slightly out-of-date spec here: http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html#parsing It's out of date because I then went to play with WebKit's HTML parser to make it do this, purely to learn more about parsing: https://bugs.webkit.org/show_bug.cgi?id=78734, which revealed a few more places that still need spec work. Since that templates are defined as a vehicle to build document fragments declaratively, the DWIM insertion mode (called "template contents" mode in HTML Templates draft) effectively describes the behavior of DocumentFragment.prototype.set. However for templates, there's also another degree of freedom of the context in which a <template> tag can appear. I am ok with keeping both together or separate. Whatever makes things move faster. I have both time, energy, and now a bit of expertise to write the modifications. Just need a consensus on the path :)
A quick update: I went ahead and drafted up the changes to HTML parser based on my WebKit experiments: http://dvcs.w3.org/hg/webcomponents/raw-file/4e492832df60/spec/templates/index.html
Current proposal (which doesn't presently have any detractors): http://lists.w3.org/Archives/Public/public-webapps/2012AprJun/0334.html Summary: DF.innerHTML chooses an "implied context element" based on the first start tag in the provided HTML. This requires no changes to the parser. Webkit patch here: http://lists.w3.org/Archives/Public/public-webapps/2012AprJun/0334.html
I'm going to go ahead and close this one. -We've got good consensus on the template element -With it, DocumentFragment.innerHTML is a 4 or 5 line polyfill for those who choose to do that. -Hixie made a strong case against adding explicit API for DF.innerHTML