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

Leif Halvard Silli wrote:
>
> I think in reality you disagree with what I intended above.
> 
>     FIRSTLY:
> 
> Change of position: I assume that both these are valid, right?
> 
>    *::marker {}/*Var1*/
>     ::marker {}/*Var2*/

Yes.

>     SECONDLY:
> 
> Why do you specifically call out pseudo-elements? The current draft 
> doesn't do that. [1]

That's the error we're trying to fix here.

> Or to ask differently, why isn't the following,
> 
>    *::marker{}
> 
> a case of a simple selector sequence where the "*" - quoting the text - 
> "is not the only component of a sequence of simple selectors"?
> 
> 1) Isn't pseudo-element covered by the word 'component'?
> 2) If yes, then what is 'pseudo-element' a component of, if not of a 
> 'simple selector sequence'?
> 3) If it is a component of a 'simple selector sequences', then it is 
> unecessary and confusing to call it out (this is what has confused me)

A pseudo-element is not part of a simple selector sequence
because it is not a simple selector. It may be appended
to the simple selector sequence, but that does not make it
part of the simple selector sequence.

>     THIRDLY:
> 
> This is what the spec says about what kind of 'component' a 
> pseudo-element is:
> 
> The "simple selectors" definition paragraph says: [2]
> 
>   ]]A simple selector is either a type selector, universal
> selector, attribute selector, class selector, ID selector, or
> pseudo-class. One pseudo-element may be appended to the last
> sequence of simple selectors in a selector.[[
> 
> Even if this paragraph defines the list of simple selectors, 
> pseudo-element is not described as a simple selector. But it IS 
> described as an appendix to a simple selector sequence. Thus it ought to 
> be considered a component of a simple selector sequence, even if it 
> (may) not (be) a simple selector itself.

No. "component" means "constituent part". If I append X to Y,
X doesn't become a component part of Y. It becomes a constituent
part of X + Y.

> 3 paragraphs further down it is said, however:
> 
>   ]]An empty selector, containing no sequence of simple selectors and no 
> pseudo-element, is an invalid selector.[[
> 
> Here the pseudo-element is not considered part of the simple selector 
> sequence.

Exactly.

> The pseudo element definition says: [3]
> 
>   ]]Only one pseudo-element may appear per selector, and if present it 
> must appear after the sequence of simple selectors that represents the 
> subjects of the selector.[[
> 
> Here too, pseudo-elements are not considered part of the simple 
> selectors sequence.

Right.

> However, the text about the negation pseudo class talks about both the 
> negation pseudo-class and the pseudo-elements as simple selectors (why 
> else would it, inside the same parenthesis, specifically exclude them 
> both from "simple selectors"?): [4]
> 
>   ]]The negation pseudo-class, :not(X), is a functional notation taking 
> a simple selector (excluding the negation pseudo-class itself and 
> pseudo-elements) as an argument. It represents an element that is not 
> represented by the argument.[[

This is also an error, that has already been fixed in the Editor's Draft.
See the discussion at
   http://lists.w3.org/Archives/Public/www-style/2009Mar/0130.html

> The grammar section also considers pseudo-elements are part of a simple 
> selector sequence - it says about pseudo-elements that they "occur only 
> in the last simple_selector_sequence" - thus it is clearly a 'component' 
> of a simple selector sequence: [5]
> 
> ]]
> pseudo
>   /* '::' starts a pseudo-element, ':' a pseudo-class */
>   /* Exceptions: :first-line, :first-letter, :before and :after. */
>   /* Note that pseudo-elements are restricted to one per selector and */
>   /* occur only in the last simple_selector_sequence. */

The grammar is written this way because the grammar for
pseudo-classes and pseudo-elements intersect. The names
of the productions here are not definitions, they are
merely suggestive; the grammar could have been written
using numerical references but it's harder to understand
that way.

> According to section 1.3 of CSS3 selectors, "the components of" a simple 
> selector sequence are called "simple selectors": [6]
> 
>   ]]what was referred to in CSS2 as a simple selector is now called a 
> sequence of simple selectors, and the term "simple selector" is now used 
> for the components of this sequence[[
> 
> Thus, a pseudo-element, being a component of a sequence of simple 
> selectors, should itself be a simple selector.

A pseudo-element is not a simple selector.
   http://lists.w3.org/Archives/Public/www-style/2009Mar/0129.html

>     CONCLUSIONS
> 
> * Simple selector sequences are made up of two kind of components:
>  - simple selectors
>  - pseudo elements

This statement is false. Simple selector sequences are made up of
simple selectors ONLY.

> * 'Components of simple selectors' are not properly defined

"Components of simple selectors" is not used anywhere in the
specification, so it doesn't matter whether it is defined or not.

~fantasai

Received on Thursday, 22 October 2009 17:29:59 UTC