[whatwg] WF2 part 1-3

Mark Schenk css at markschenk.com
Wed Aug 25 02:48:48 PDT 2004


On Sun, 22 Aug 2004 19:26:00 +0000 (UTC), Ian Hickson <ian at hixie.ch> wrote:

>> The repeat model is complex. Could we make is slightly simple by
>> dropping the repeat-template attribute?
>
> It used to be a lot simpler. Then MarkS and others came along and made  
> all these requests to make it "useful in the real world" or something...  
> ;-)

You're almost making me feel guilty ;-)

The current complexity is partly caused by the ability to have different  
repetition blocks interleave, which I still believe is necessary, even for  
a simple repetition model. In my (failed) attempts to formulate changes  
for the current repeat-model, I got stuck because I'm not sure what the  
scope of the repeat-model in WF2 should be. As you already mentioned in  
another post [1]:

".. the repetition stiff [sic] in WF2 was never meant to be a generic  
repetition system. It's meant specifically for repeating form sections in  
HTML."

That's exactly what is troubling me. The repetition stuff in WF2 is too  
limited for a generic repetition system, but it is also feels quite  
verbose and complex for the simple stuff, as pointed out by Håkon. I  
haven't been able to put my finger on a good solution though. :(

[1]  
http://listserver.dreamhost.com/pipermail/whatwg-whatwg.org/2004-August/001854.html


>> I don't like the name of the repeat-* attributes. I suggest these names  
>> instead:
>>
>>    <tr index="1">
>>    <tr id="order" repeat="3">
>>
>> The "repeat" attribute indicates that the element is a template.
>
> Interesting idea.

I think it is even more confusing... the existing proposal may be very  
verbose, it is very clear what the different attributes mean. Now you  
remove the repeat-start attribute, but add a new index attribute. Where is  
the improvement?

Another problem with the existing proposals is the fact that you will  
encounter elements with the same index/repeat value, when you use  
different repeat templates. Example:

<tr repeat="0" repeat-template="two_rows">
<td>First row</td>
<td>Second row</td>
</tr>
<tr repeat="0" repeat-template="one_row">
<td>First row</td>
</tr>
<!-- here start the templates -->
<tr id="two_rows" repeat="template" repeat-start="0">
<td>First row</td>
<td>Second row</td>
</tr>
<tr id="one_row" repeat="template" repeat-start="0">
<td>First row</td>
</tr>

I don't know if it is possible to have spaces inside attribute values (I  
don't have the apparently infamous Goldfarb book lying here, but as  
"title" can have spaces, I don't see why any attribute can't have spaces).  
If it is possible, why not introduce the following:

<tr repeat="two_rows 0">
<td>First row</td>
<td>Second row</td>
</tr>
<tr repeat="one_row 0">
<td>First row</td>
</tr>
<!-- here start the templates -->
<tr id="two_rows" repeat-start="0">
<td>First row</td>
<td>Second row</td>
</tr>
<tr id="one_row" repeat-start="0">
<td>First row</td>
</tr>

That would kill the repeat-template attribute because you merge it into  
one attribute on the repetition block, and it would give you unique values  
for "repeat" attributes throughout the document:

repeat="[repetition template id] [repetition block index]"

It could also remove the need for a "repeat" attribute on a repetition  
template: the repeat-start would be sufficient to recognize it as a  
repetition template.

Or do the same trick with spaces inside the attribute:

<tr id="one_row" repeat="template 1">
<td>First row</td>
</tr>

The attribute indicates that it is a template, with a certain value for  
repeat-start. It would only mean that you can't have a repetition template  
with the id as "template" otherwise things get messy :D:

If I'm rambling nonsense, please don't hesitate to correct me, but I  
haven't been struck by a brilliant idea yet about the repetition stuff and  
this is the best I can come up with right now :)


> I also like the fact that "repeat" being used for both templates and
> repetition blocks means you can't have an element that is both:
>
>    <tr index="1" repeat="1">

Would this be valid/possible anyway?


-- 
Mark



More information about the whatwg mailing list