Re: [CSSWG] Release Candidate for CSS Namespaces Test Suite

Anne van Kesteren On 09-09-29 15.24:

> On Tue, 29 Sep 2009 15:11:39 +0200, Leif Halvard Silli :
>>    In pointing to that grammar, do you then refer to the following 3  
>> lines - or do you also refer to something more than that in that  
>> grammar? The 3 lines:
>>
>>      universal
>>        : [ namespace_prefix ]? '*'
>>        ;
> 
> The point of these lines is that the namespace_prefix is tied to the *. If  
> you omit the * you cannot use the namespace_prefix.


My view is not interesting. I was just testing UA.

In Webkit the above is simply interpreted to say that we cannot do 
this:  ns|{}.  Webkit did not interpret it as saying that one 
cannot do this:  ns|[attr]{}.

   [...]

Regarding omitting the '*':

> The grammar does allow this and the prose does too. See the  

> simple_selector_sequence production.


simple_selector_sequence
   : [ type_selector | universal ]
     [ HASH | class | attrib | pseudo | negation ]*
   | [ HASH | class | attrib | pseudo | negation ]+
   ;

If the "*" at the end of line 3 there pertain to both line 2 and 3 
(right?), then I agree that the grammar cover this. Thanks!

But then, I would also say that it is silly that CSS 3 has 
copy-pasted this sentence from CSS 21:

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

(The only difference being that 'simple selector' has been 
replaced by 'a sequence of simple selectors'.)

Rather than saying that "the * may be omitted", it should say that 
the 'universal selector' may be dropped. (Or else it could just as 
well have said that the type selector could have been dropped - as 
the grammar in fact show you can - of course it may then select 
other elements.)

This focus on the character '*' makes it seem as if there is a 
shorthand for the universal selector - namely to drop it.

My point is: The reason one may, in some cases, drop the '*' is 
because one may be certain that the selector sequence will still 
select the very same thing - you get the same result. Despite that 
in dropping it, it becomes another kind of selector sequence.

>> Let me go through what the prose says:
>>
>>    The prose says [http://w3.org/TR/css3-selectors/#universal-selector]:
>>
>>      "If the universal selector is not the only component of
>>       a sequence of simple selectors, the * may be omitted."
>>
>>      Examples:
>>
>>      *[hreflang|=en] and [hreflang|=en] are equivalent,
>>      [ snip ]
>>
>>    The logical conclusion to this is that [hreflang|=en] is - in fact -  
>> a universal selector. Because, according to CSS 2.1, every simple  
>> selector is either a universal selector or type selector  
>> [http://w3.org/TR/CSS21/selector.html#selector-syntax].
> 
> Please read it all: "The universal selector, written as an asterisk (*  
> U+002A), represents the qualified name of any element type." It is not  
> needed for the non-namespace cases.


What do you mean by 'non-namespace cases'? *|*{} is also a 
non-namespace case.

>>    The next section of CSS3 selectors talks about universal selectors  
>> and namespaces [http://w3.org/TR/css3-selectors/#univnmsp]. All of the  
>> examples in that section types the "*" directly - but we cannot conclude  
>> from that, that the "*" _has_ to be typed directly.
>>
>>    Here are the example section in full:
>>
>>      ns|* all elements in namespace ns
>>       *|* all elements
>>        |* all elements without a namespace
>>         * if no default namespace has been specified, this
>>           is equivalent to *|*. Otherwise it is equivalent
>>           to ns|* where ns is the default namespace.
>>
>>    Here it is said that "*" is equivalent to "*|*". The logical  
>> conclusion is "*|*" and "*" are equivalent also when the universal  
>> selector is omitted.
> 
> No, that is reading between the lines. (And contrary to the grammar.) Your  
> further examples seem all along the same lines of not reading the  
> specification literally and trying to infer things that are not there.

It is not reading between the line, it is reading while being 
inspired by CSS21. In CSS21 every 'simple selector' - or as CSS3 
puts it, every 'simple selector sequence', is said to be either a 
type selector or a universal selector:

"A simple selector is either a type selector or universal selector 
followed immediately by zero or more attribute selectors, ID 
selectors, or pseudo-classes, in any order."

http://www.w3.org/TR/CSS21/selector#selector-syntax

It follows, from CSS21, that even if you omit the *, you are still 
dealing with either a type selector or a universal selector.
-- 
leif halvard silli

Received on Tuesday, 29 September 2009 15:58:08 UTC