[whatwg] [WF2] Web Forms 2.0: Repetition and type ID

    Just had a thought: rename this to "repeat-id" so people don't 
confuse the repetition system with a templating system.

Ian Hickson wrote:
> On Sat, 2 Jul 2005, Matthew Raymond wrote:
> 
>>Couldn't we just solve this with an attribute called "templateid" that 
>>would be used in place of the |id| attribute for templates. We could 
>>then use |id| for backwards compatibility.
> 
> I don't understand how that would help. The problem is not with the 
> templateid attribute, it's with any ID attribute. For example:
> 
>    <input id="field[x]" ...>
> 
> ...if you want to give the fields a unique ID in each repetition block.

    My knowledge of the subject is limited, but it's my understanding 
that the use of "[" and "]" is a source of difficulty due to XML schemas 
and the limitations of software tools. However, there are no such 
limitations on a simple string attribute which can be used to GENERATE a 
unique |id|.

    Now, consider CSS. If you have and |id| that contains 
"planet[planets].moons", the following doesn't work in Firefox, Opera or 
IE6:

| #planet[planets].moons { /* CSS properties here. */ }

    Nor does this:

| #planet[planets] { /* CSS properties here. */ }

    However, this does:

| [repeat-id="planet[planets].moons"] { /* CSS properties here. */ }

    Well, IE6 doesn't recognize the last example. (No real surprise 
there.) It needs an |id|. With |repeat-id|, you just specify a regular 
|id| attribute on the repeating element.

    (Me thinks the planets example may be flawed regarding the periods...)

    In theory, you could have |repeat-id| be equal to |id| in cases 
where |repeat-id| is not specified. Personally, it makes more semantic 
sense to me to have |repeat-id| required, because it makes it clear that 
the |id| is used in the repetition process.

> (Also, multiple ID attributes per element would also be a problem in most 
> schema languages, and square brackets are a problem in any ID attribute, 
> not just "id".)

    It's not an attribute of type ID. That's the whole point. The 
repetition system converts it into an |id| when it generates a new block.

Received on Sunday, 3 July 2005 06:28:16 UTC