[whatwg] WF2 Repitition Model

Ian Hickson ian at hixie.ch
Sun Jun 27 09:30:54 PDT 2004


On Sun, 27 Jun 2004, Michael wrote:
>
> I think I missed something important, why is a template element is bad?

An element would confuse non-WF2 UAs a lot more than an element, and would
cause definite parsing problems for HTML-based WF2 UAs. For example, in
HTML4, the following:

   <p> ...
   <p> ...
   <p> ...

...is three siblings. You can make the middle one into a template:

   <p> ...
   <p repeat="template"> ...
   <p> ...

...without changing the parse rules. But what if you have:

   <p> ...
   <template> <p> ... </template>
   <p> ...

...? Does the <template> element end the first <p>, or not?

What about if you really wanted:

   <p> ... <template> ... </template>
   <p> ...
   <p> ...

...?

The <ins> and <del> problems in HTML4 already have this problem, and it is
very confusing for authors who use them.


Also, the way the repetition model is defined at the moment, it could even
work in, e.g., XHTML2:

  <html xmlns="http://www.w3.org/2002/06/xhtml2"
        xmlns:wf2="http://www.w3.org/1999/xhtml">
   ...
    <ol>
     <li wf2:repeat="template">
      ...
     </li>
    </ol>
    ...
  </html>

The following, however, would be a breach of the XHTML2 content model:

  ...
   <ol>
    <wf2:template>
     ...

...since <ol> can only contain <li>s.


Finally, the main question: why is an element it better? The comment thing
to hide the element's children from legacy UAs is non-compliant (there is
no SGML construct that allows a comment-like node while still parsing
elemnts, and even if there was, it would mean you couldn't have comments
inside the template, which doesn't seem like a good thing).

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list