[whatwg] Declarative Inert DOM (e.g. the <template> element)

Rafael Weinstein rafaelw at chromium.org
Thu Nov 17 16:37:19 PST 2011


On Thu, Nov 17, 2011 at 2:45 PM, Adam Barth <w3c at adambarth.com> wrote:
> On Thu, Nov 17, 2011 at 2:22 PM, Rafael Weinstein <rafaelw at chromium.org> wrote:
>> On Thu, Nov 17, 2011 at 12:50 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
>>> On Thu, Nov 17, 2011 at 11:15 AM, Rafael Weinstein <rafaelw at chromium.org> wrote:
>>>> Big question: by what mechanism are these elements inert?
>>>
>>> I like Adam's suggestion of a new document without a browsing context.
>>>  You can still move the elements into the active document and have
>>> them "just work", and all the other issues are taken care of "for
>>> free".
>>
>> I think that would be a fine solution. When I discussed this with
>> various folks, that option came up as well, but some were concerned
>> that a document might too heavy weight.
>>
>> Keep in mind that pages may have *many* <template> declarations. I'd
>> expect a sophisticated page/app to have template declarations the
>> hundreds if not thousands.
>
> Have you benchmarked it?  Documents that lack browsing contexts are
> actually pretty light.  Most of the "weight" comes from browsing
> context.  As an example, we create and destroy a document every time
> someone assigns to innerHTML.

Nope. If the overhead of creating documents is a non-issue, then
so-much-the-better.

Would being a document imply <html> or <body>. I.e. would the following

<template>Hello, World</template>

Result in myTemplate.contentDocument being

<html>
 <body>Hello, world</body>
</html>

?

>
> Adam
>



More information about the whatwg mailing list