Re: [webcomponents] Template element parser changes => Proposal for adding DocumentFragment.innerHTML

On Wed, May 9, 2012 at 10:38 AM, Scott González <scott.gonzalez@gmail.com>
 wrote:

> Users will surely find this annoying when they know that it can be
> automated. This will also result in users being tripped up on this as they
> learn about this feature by looking at some other code that isn't passing a
> context (because it doesn't need one) and then all of a sudden they hit a
> case where they need one and it fails.
>

I agree. It's annoying having to specify "tr" when I only have td's inside
the template.

On Wed, May 9, 2012 at 10:45 AM, Simon Pieters <simonp@opera.com> wrote:

> On Wed, 09 May 2012 19:29:42 +0200, Ryosuke Niwa <rniwa@webkit.org> wrote:
>
>> On May 9, 2012 10:26 AM, "Simon Pieters" <simonp@opera.com> wrote:
>>>
>>> On Wed, 09 May 2012 19:01:42 +0200, Ian Hickson <ian@hixie.ch> wrote:
>>>>
>>>> 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'**);
>>>>
>>>
>>> Or just string with the tag name, so it works the same as <template
>>>
>> context>?
>>
>> What happens when I pass "a"?
>>
>
> I think that should get "in body".


That makes sense.

Do we need to support anything more than "svg" and "math" to get foreign
> content parsing here?


Probably not.

- Ryosuke.

Received on Wednesday, 9 May 2012 18:24:57 UTC