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

Ian Hickson ian at hixie.ch
Sun Jul 3 06:40:09 PDT 2005

On Sun, 3 Jul 2005, Matthew Raymond wrote:
> Just had a thought: rename this to "repeat-id" so people don't confuse 
> the repetition system with a templating system.

Rename _what_ to repeat-id? The attributes with the problem are the normal 
"id" attribute on every element.

> > 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|.

I don't understand how that would help the example above.

> 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. */ }

The following does:

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

...but even if that were not the case, it is irrelevant -- the square 
brackets are only ever found on elements that are in repetition templates, 
and repetition templates are always display: none, with no reason to want 
to style them, let alone style them differently from elements in actual 
repetition blocks.

> 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.

I really don't understand what you are proposing. Are you proposing adding 
a new attribute to all elements called repeat-id?

> > (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.

What about attributes in other namespaces that happen to be of type ID 
but aren't called "id"?

This seems to be a very complex solution (in terms of implementation) 
compared to just allowing two more delimiter characters, especially 
considering that most people will never come across this problem.

It also introduces new problems, for example, now that they aren't IDs, 
the tools fantasai mentioned would still not catch duplicates.

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