W3C home > Mailing lists > Public > www-style@w3.org > February 2005

Re: [css21] multiple ID attributes with the same value

From: Laurens Holst <lholst@students.cs.uu.nl>
Date: Mon, 14 Feb 2005 13:47:25 +0100
Message-ID: <42109DDD.6050308@students.cs.uu.nl>
To: www-style@w3.org
Cc: Ian Hickson <ian@hixie.ch>

Ian Hickson wrote:
>>>>Would it be possible that CSS 2.1 specifies something similar to
>>>>XPath 1.0[1]? Something in the lines of: "When multiple ID
>>>>attributes with the same attribute value are found only the first
>>>>should be considered significant."
>>>
>>>What does that mean?
>>
>>That in a document such as:
>>
>> <foo>
>>  <bar xml:id="xyz"/>
>>  <bar xml:id="xyz"/>
>> </foo>
>>
>>... with the following style rule applied:
>>
>> bar{ background:lime }
>> #xyz{ background:red }
>> bar#xyz:first-child{ background:lime }
>>
>>... there is no red.
> 
> Oh, I see. IMHO that would be bad, and is not what is implemented either.
> 
> Both elements have the ID "xyz", so both should match "#xyz".

Doesnít that behaviour allow for misuse?

If Anneís suggestion is followed, authors would not be able to use IDís 
as class attributes. If this works as you suggested in actual 
implementations, even though invalid, people are going to (unknowingly) 
misuse it.

So, I agree with Anne that this would be a viable change. OTOH, there 
are probably already a ton of sites out there which do this incorrectly. 
And there is something to be said for an argument like that itís not the 
task of CSS to make people form their documents well (then again, it 
couldnít hurt).


~Grauw

-- 
Ushiko-san! Kimi wa doushite, Ushiko-san nan da!!
Received on Monday, 14 February 2005 12:48:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:35 GMT