W3C home > Mailing lists > Public > public-css-testsuite@w3.org > February 2011

Test case for the \* type selector (CSS3 selectors)

From: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
Date: Sun, 20 Feb 2011 06:51:14 +0100
To: public-css-testsuite@w3.org
Message-ID: <20110220065114485440.90e4af5f@xn--mlform-iua.no>
I propose that the CSS3 selectors test suite is updated with a test 
case for the a type selector:

	   \*{color:red} /* valid selector which shouldn't work*/

Background: The \* selector might be easy to confuse with *{}. And 
Webkit falls into that trap. And thus it sees the selectors

	\*{} 
	\00002a{} 

as synonymous for 

	*{}

and thereby \*{} becomes a selector that only works in Webkit. Because, 
although \*{} is valid, it cannot select anythig - as there are no <*> 
elements in XML or HTML. (CSS2 says that \ "cancels the meaning of 
special CSS characters'. And the special meaning of * is that it is the 
universal selector.) This is identical to how  

	-div{} 

is a valid selector. But it could never select anything as there are no 
elemetns that begins with the character '-'.

Note, btw, that Webkit has no problems with foo.\*{} - it is just \*{} 
that is problematic.

Note also that * is a special kind of 'special CSS character'. The 
other special characters are combinators, and thus have only one 
meaning - thereby it is easy to see what they default to when the 
special meaning is cancelled. Whereas '*' has two meanings: 'universal 
selector' and 'any namespace selector'.  Also, if one tries to compare 
the universal selector with type selectors, then - by analogy - it is 
easy to think that Webkit is correct. This is how the analogical 
deduction goes:

	\d\i\v{}  /* This it equal to this: */
	div{}     /* Hence - by analogy - it is logical to think that */
	\*{}      /* would work the same as */
	*{}

The point I am trying to make only being that the Webkit behaviour make 
some sense, even though it is incorrect. Which is why there should be 
test case.

Suggested test case for the univeral selector issue:

<!DOCTYPE html><!-- contributed by Leif H Silli -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Escaped, Universal selector</title>
<style type="text/css">* {color:lime} p \* {color:red}</style>
</head><body><p><span>This paragraph should be green.</span></p>
</body></html>
-- 
Leif Halvard Silli
Received on Sunday, 20 February 2011 05:51:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 20 February 2011 05:52:14 GMT