W3C home > Mailing lists > Public > www-style@w3.org > September 2009

Re: [Selectors] Clarify when universal selector may be omitted

From: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
Date: Wed, 30 Sep 2009 02:06:51 +0200
Message-ID: <4AC2A11B.2060309@xn--mlform-iua.no>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: public-css-testsuite@w3.org, www-style list <www-style@w3.org>
Boris Zbarsky On 09-09-30 00.32:

> On 9/29/09 1:58 PM, Leif Halvard Silli wrote:
>> Here is a text proposal:
>> "If the universal selector is not the only component of a sequence of
>> simple selectors and if it also is without the namespace component, then
>> the universal selector may be omitted."
> This sounds fine to me, though not strictly necessary.  The "universal 
> selector" is not '*' in Selectors but "an optional namespace component 
> followed by '*'".

And that is why I said "and if it [the universal selector] is 
without the namespace component". The draft: "an optional 
namespace component is now allowed in element type selectors, the 
universal selector and attribute selectors".[*] Given the selector 
sequence 'dc|*[attr]', then dropping the universal selector (dc|*) 
would be risky. What is the not strictly necessary that I said?

>  Which means that while you can omit the whole thing, 
> you can't just omit the '*' and include the namespace component, 
> Webkit's behavior to the contrary notwithstanding.

   What seems strictly necessary is to better the CSS 3 Selectors 
text which, by quoting CSS21, is focusing on the "*" character:

"If the universal selector is not the only component of a sequence 
of simple selectors, the * may be omitted."

  That appears tautological and only means you can't drop the '*' 
here: *{}. With a kind reading, it also means that you can't drop 
the second '*' here: *|*{}. If you do not have enough baggage, 
then it means that you can drop the second "*" here: *|*{}. If you 
have too much CSS 21 baggage then it means that you can drop the 
second '*' here: *|*[attr].

   Now, you formulated the question: when can we drop the 
universal selector? However, perhaps the question that CSS 3 
Selectors tries to answer in that sentence is when we can drop the 
'*'? (Which is when dropping is guaranteed to not affect the 
selection.) If so, then the text could be reformulated e.g. like this:

"When the * character is the only component of the universal 
selector, except when the universal selector is the only simple 
selector in the sequence, then the universal selector may be 
omitted from the simple selectors sequence.

[*] The draft speaks of the namespace component as an optional 
component of the simple selectors components: a component of a 
component. http://www.w3.org/TR/css3-selectors/#changesFromCSS2
leif halvard silli
Received on Wednesday, 30 September 2009 00:07:26 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:13:39 UTC