W3C home > Mailing lists > Public > www-validator-css@w3.org > February 2008

Re: [bug] warning on valid selector

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Thu, 28 Feb 2008 09:11:29 +0200
Message-ID: <004a01c879d9$247c5010$0400000a@DOCENDO>
To: <www-validator-css@w3.org>
Cc: "Le Sage" <gammaprod@worldonline.fr>

Le Sage wrote:

> span[hello="Cleveland"][goodbye="Columbus"] { color: blue; }
> source: http://www.w3.org/TR/CSS21/selector.html#matching-attrs

They have a rather childish example there, and misleading too, since the 
name "span" suggests that this relates to HTML, but the attributes 
aren't HTML attributes. But of course the example complies with the 
general syntax in the CSS 2.1 draft.

> but when I tried to validate it, I got this warning:
> [hello="Cleveland"] and [goodbye="Columbus"] are incompatible

It's very odd and apparently unjustified. There is no reason - 
especially from the CSS perspective - why two attribute selectors should 
be "compatible".

> Thought, this selector is working on IE7, FF, Opera, Safari & probably
> others.

It does not work on IE 7 in Quirks Mode, when applied to an "HTML" 
document (that is, a document mostly complying with HTML specifications 
but containing those non-HTML attributes). In Quirks Mode, IE 7 lacks 
much of the more advanced support, such as all support to attribute 
selectors. You can see this if you add the comment
<!-- -->
at the start of the HTML document.

> Did I find a bug in the validator?

I think you did.

The bogus warning does not appear if the selector is just

So apparently the W3C CSS Validator thinks that when a selector contains 
two attribute selectors, they should have the same attribute value. This 
makes no sense of course. Perhaps people who wrote this part of the code 
just forgot to include the condition "and the attribute names are the 

Jukka K. Korpela ("Yucca")
Received on Thursday, 28 February 2008 07:13:01 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:40:44 UTC