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