[whatwg] Repetition model changes

Matthew Raymond mattraymond at earthlink.net
Sat Jun 26 15:50:14 PDT 2004


Ian Hickson wrote:
> 2. <repeat> is gone. Instead, we have a new attribute repeat-start, which
> says how many times to repeat the template when the page is loaded. It
> defaults to one, which happens to be the same number of blank rows as you
> would see if you were loading the page in a legacy UA.

    I was just thinking about something. Say you have a website where 
people can register their team for a competition. There have to be at 
least five team members in the team to register, but they can have as 
many as ten members on the team. The form they fill out requests the 
name of each person. Under the current spec, you'd have the following:

--------------------------------------------------------------------

   <table>
    <tr>
     <th>Name</th>
    </tr>
    <tr id="order" repeat="template" repeat-start="5" repeat-min="5"
        repeat-max="10">
     <td><input type="text" name="row[order].name" value=""></td>
     <td><button type="remove">Remove This Row</button></td>
    </tr>
   </table>

   <p><button type="add" template="order">Add Row</button></p>
   <p><button type="submit">Submit</button></p>

--------------------------------------------------------------------

    There's just one problem. The form is supposed to start out with 
five elements, but on a non-WF2 UA, you'd only see one. As a result, the 
server would probably initially populate the table with at least four 
entries...

--------------------------------------------------------------------

    <tr repeat=0>
     <td><input type="text" name="row0.name" value=""></td>
     <td><button type="remove">Remove This Row</button></td>
    </tr>
    <tr repeat=1>
     <td><input type="text" name="row1.name" value=""></td>
     <td><button type="remove">Remove This Row</button></td>
    </tr>
    <tr repeat=2>
     <td><input type="text" name="row2.name" value=""></td>
     <td><button type="remove">Remove This Row</button></td>
    </tr>
    <tr repeat=3>
     <td><input type="text" name="row3.name" value=""></td>
     <td><button type="remove">Remove This Row</button></td>
    </tr>
    <tr id="order" repeat="template" repeat-min="5" repeat-max="10">
     <td><input type="text" name="row[order].name" value=""></td>
     <td><button type="remove">Remove This Row</button></td>
    </tr>

--------------------------------------------------------------------

    Note that I left off repeat-start because the default value is one. 
So why exactly do we need repeat-start???

> 4. I've changed the "do not process this attribute" prefix from "[]" to a
> non-breaking zero-width space character, U+FEFF. This character is
> generally harmless, it can always be ignored safely on the server side (it
> is also the BOM character), and so can be used in forms that will be sent
> to legacy UAs without having to worry about random characters appearing
> all over the place. In WF2 UAs, it'll be silently stripped.
>
 >
> 5. I haven't changed the [id] replacement thing. None of the other
> proposals (autoname, appending numbers, appending numbers and dots, using
> just the order of the controls, using strings that are unlikely to match
> real content, etc) solved all the other use cases, IMHO. If you think I
> missed a suggestion for replacing [id] let me know.

    Can someone explain to me why what scenario results in [id] being a 
problem. I can't seem to find an example in the mailing list.



More information about the whatwg mailing list