W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2012

Re: Making <template> play nice with XML and tags-and-text

From: Henri Sivonen <hsivonen@iki.fi>
Date: Sun, 5 Aug 2012 17:00:15 +0300
Message-ID: <CAJQvAuerNNMQ37iWWAUwGsWvXwuV20Mr8FnmiwX0y5dS_+HeLg@mail.gmail.com>
To: Adam Barth <w3c@adambarth.com>
Cc: Adam Klein <adamk@chromium.org>, WebApps WG <public-webapps@w3.org>, Ian Hickson <ian@hixie.ch>, Rafael Weinstein <rafaelw@chromium.org>
On Wed, Jul 18, 2012 at 11:35 PM, Adam Barth <w3c@adambarth.com> wrote:
> On Wed, Jul 18, 2012 at 11:29 AM, Adam Klein <adamk@chromium.org> wrote:
>>
>> On Wed, Jul 18, 2012 at 9:19 AM, Adam Barth <w3c@adambarth.com> wrote:
>>>
>>> Inspired by a conversation with hsivonen in #whatwg, I spend some time
>>> thinking about how we would design <template> for an XML world.  One idea I
>>> had was to put the elements inside the template into a namespace other than
>>> http://www.w3.org/1999/xhtml.

On the face of things, this seems a lot less scary than the wormhole
model. I think this merits further exploration! Thank you!

>> One question about your proposal: do the contents of <template> in an HTML
>>> Unlike the existing "wormhole" <template> semantics, in this approach the
>>> tags-and-text inside <template> would translate into DOM as usual for XML.
>>> We'd get the "inert" behavior for free because we'd avoid defining any
>>> behavior for elements in the http://www.w3.org/2012/xhtml-template namespace
>>> (just as no behavior is defined today).
>>
>> This does get you inertness, but doesn't avoid querySelector matching
>> elements inside <template>.

If changes of the magnitude discussed here are on the table for HTML
parsing, I don't see why querySelectorAll() or even Selectors should
be assumed to be unchangeable.

>> Also, the elements inside <template>, though they appear to be HTML,
>> wouldn't have any of the IDL attributes one might expect, e.g., <a
>> href="foo"></a> would have no "href" property in JS (nor would <img> have
>> src, etc). They are, perhaps, too inert.

I think that's not a problem, because you're not supposed to mutate
the template anyway. You're supposed to clone the template and then
mutate the clone.

> That's unfortunate.  I guess that means CSS styles will get applied to them
> as well, which wouldn't be what authors would want.

That's not really a problem as long as subtrees with elements in the
template namespaces are rooted at a display: none; <template> element.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/
Received on Sunday, 5 August 2012 14:00:42 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:54 GMT