- From: Ian Hickson <ian@hixie.ch>
- Date: Wed, 9 May 2012 17:01:42 +0000 (UTC)
- To: Henri Sivonen <hsivonen@iki.fi>
- cc: Rafael Weinstein <rafaelw@google.com>, Webapps WG <public-webapps@w3.org>, Yehuda Katz <wycats@gmail.com>
Quick alternative proposal that might work for both <template> parsing and DocumentFragment.innerHTML: Have createDocumentFragment() take as an argument a context element. Maybe also make it a mutable attribute of the object. Defaults to its owner document's body element or root element or some such. Null means no root element. var df = document.createDocumentFragment(document.body); df.contextElement = document.createElement('style'); Have innerHTML use that as the context element to the fragment parsing algorithm. df.innerHTML = 'p::before { content: '<hello> <world>'; }'; Have <template> take an argument that's the element tag name for it to use to create its context element. Defaults to <body>. <template context="tr"> <td> </template> <template context="svg"> <g/> </template> Parse <template> by creating a new Document object that's like the ones you get from createDocument() (i.e. "dead"), and then creating a DocumentFragment owned by that Document, and then pushing that DocumentFragment onto the stack instead of the <template> element, but set up to act like the <template> element for the purposes of being popped off. (Except when parsing without a browsing context, then you just parse normally.) Not sure how solid this is, but it's an idea at least. Hopefully an original one, though I'm sure y'all have considered it before. :-) -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 9 May 2012 17:02:29 UTC