W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2004

[whatwg] Solution to Repetition Model Template Problem

From: Matthew Raymond <mattraymond@earthlink.net>
Date: Fri, 25 Jun 2004 16:58:38 -0400
Message-ID: <40DC91FE.2000608@earthlink.net>
    As you may already know, there's a serious problem with the current 
repetition system in Web Forms 2.0. The problem is that the template 
always shows up in non-WF2 UAs. You could use CSS to hide the template, 
but then how would you provide styling to blocks generated from the 
template and how would you prevent the template control data from being 
submitted? I have a solution to these problems: Replace the "replace" 
attribute with a <template> element.

    The current model looks like this:

    <tr id="order" repeat="template">
     <td><input type="text" name="row[order].product" value=""></td>
     <td><input type="text" name="row[order].quantity" value="1"></td>
    </tr>

    The solution I propose would look like this:

    <template id="order"><!--
      <tr id="row[order]">
       <td><input type="text" name="row[order].product" value=""></td>
       <td><input type="text" name="row[order].quantity" value="1"></td>
      </tr>
    --></template>

    The <template> element uses the text in the comments to create the 
new block, which I think is really more in keeping with what the 
repetition model is doing anyways. Furthermore, the <template> element 
frees up the "id" attribute so that unique IDs can be assigned to each 
new block.

    Because the contents of <template> are in comments, and because 
undefined elements are ignored in HTML, the template never shows up in a 
non-WF2 UA. Furthermore, since templates are not rendered in WF2, it's 
not visible in a WF2 UA either.

    The repeat attribute would remain unchanged for all non-template 
elements.

    Any thoughts on this?
Received on Friday, 25 June 2004 13:58:38 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:34 UTC