- From: Ryosuke Niwa <rniwa@webkit.org>
- Date: Wed, 8 Feb 2012 15:11:59 -0800
- To: Dimitri Glazkov <dglazkov@chromium.org>
- Cc: public-webapps <public-webapps@w3.org>, Henri Sivonen <hsivonen@iki.fi>, Adam Barth <w3c@adambarth.com>, Ian Hickson <ian@hixie.ch>, Rafael Weinstein <rafaelw@google.com>
- Message-ID: <CABNRm63NF8ms9qzE2k8QWnn=2bVjsr3pHC9BYdq+Ri8H_LmTDg@mail.gmail.com>
On Wed, Feb 8, 2012 at 2:54 PM, Dimitri Glazkov <dglazkov@chromium.org>wrote: > On Wed, Feb 8, 2012 at 2:41 PM, Ryosuke Niwa <rniwa@webkit.org> wrote: > > On Wed, Feb 8, 2012 at 2:00 PM, Dimitri Glazkov <dglazkov@chromium.org> > > wrote: > >> > >> == IDEA 1: Keep template contents parsing in the tokenizer == > >> > >> PRO: if we could come up with a way to perceive the stuff between > >> <template> and </template> as a character stream, we enable a set of > >> use cases where the template contents does not need to be a complete > >> HTML subtree. For example, I could define a template that sets up a > >> start of a table, then a few that provide repetition patterns for > >> rows/cells, and then one to close out a table: > >> > >> <template id="head"><table><caption>Nyan-nyan</caption><thead> ... > >> <tbody></template> > >> <template id="row"><tr><template><td> ... > </td></template></tr></template> > >> <template id="foot"></tbody></table></template> > >> > >> Then I could slam these templates together with some API and produce > >> an arbitrary set of tables. > > > > > > But that could be done in the second approach as well, right? All you > need > > to do is replace "..." by <span class="placeholder"></span> and you can > > replace that element later by some API. > > I am not sure I understand what you're saying here, so I'll try to > clarify the example. The first and last templates contain incomplete > tag structures (or partial trees as I call them later--not sure what > the term is): the first only contains the opening <table> and <tbody> > tags, and the last one closes them. Oh, I see what you're saying. But if the authors really wanted to do that, they can just use script element, right? Of course they can't nest-script elements but nesting templates that have unpaired tags doesn't sound like a common use case. Also, if we're supporting nested templates, it's much more natural to do: <template id="table"> <table> <template id="head"> <caption>Nyan-nyan</caption> <thead>... </thead> </template> <template id="row"> <tbody> <tr><template><td>...</td></template></tr> </tbody> </template> </table> </template> - Ryosuke
Received on Wednesday, 8 February 2012 23:12:49 UTC