W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: [webcomponents] HTML Parsing and the <template> element

From: Roland Steiner <rolandsteiner@google.com>
Date: Thu, 9 Feb 2012 14:31:24 +0900
Message-ID: <CACFPSpiJDGSFjzX1-mTgmGbFnxRNy2Xaftg1G6BooN3EZ0Yv=Q@mail.gmail.com>
To: Dimitri Glazkov <dglazkov@chromium.org>
Cc: Ryosuke Niwa <rniwa@webkit.org>, Brian Kardell <bkardell@gmail.com>, Erik Arvidsson <arv@chromium.org>, Henri Sivonen <hsivonen@iki.fi>, Ian Hickson <ian@hixie.ch>, Rafael Weinstein <rafaelw@google.com>, Adam Barth <w3c@adambarth.com>, public-webapps <public-webapps@w3.org>
On Thu, Feb 9, 2012 at 13:45, Dimitri Glazkov <dglazkov@chromium.org> wrote:

> On Wed, Feb 8, 2012 at 8:16 PM, Ryosuke Niwa <rniwa@webkit.org> wrote:
> > On Wed, Feb 8, 2012 at 7:31 PM, Brian Kardell <bkardell@gmail.com>
> wrote:
> >>
> >> Then why not something like
> >>
> >> <template id="a">world</template>
> >> <template id="b">hello <partial with="a"></template>
> >
> > Right. If we were to disallow nested templates, that's the way to go. The
> > question is whether we should disallow nested templates or not.
>
> Okay, I am changing my mind. I don't think we should gate this
> discussion on whether nested <template> elements should be allowed.
> First, it's a very drastic design decision that will do doubt hinder
> the developers of templating libraries. Honestly, I wonder if we
> should always aim to avoid making these types of decisions at a
> platform level. Second, it possibly doesn't even matter.
>
> If and only if we decide that the contents of <template> element MUST
> be perceived as a string--not a DOM subtree--will we face the question
> of disallowing nested templates. As demonstrated in IDEA 2, we can
> still totally still produce usable--nested or not--inert chunks of
> DOM, per initial requirements.
>
> So I think we should get back to answering the question: is it crucial
> that template contents are parsed as a character stream? From there,
> we can walk either toward puzzling over nested templates or just
> moving along, nothing to see here.
>

In my experience, things like asymmetrical templates (e.g., containing an
opening tag only) look very useful at first, but turn out to cause more
headaches than they are worth in the long run. E.g., causing ugly errors
when you instantiate a start template, but not an end template, or even
simply the point of time between instantiating the start and the end. You
cannot clone such a template's content, etc.

To raise another facet (and please excuse if this has already been
discussed and settled): Do we want to be able to manipulate the contents of
a template via JS? This would seem more useful to me than character
streams. I remember good arguments pro and contra on this a while back.


Cheers,

- Roland
Received on Thursday, 9 February 2012 05:32:17 GMT

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