[selectors] pseudo-element, component of section of simple selectors, simple selector

Fantasai, and all others!

(Thanks to Philip TAYLOR for many contributions to this and my previous 
letter and good off-list discussion! All errors are on me.)

With references to my previous letter [1].

The 'spirit' of the prose in CSS 3 seems partly to be that a pseudo-element is not a 'simple selector'. However, with a closer look, the draft is not clear about this. More importantly, and partly as a consequence of the unclarity w.r.t. the former, the draft is unclear as to whether 'pseudo-element' is a 'component' of a 'sequence of simple selectors'. Currently, the only kind of 'component' that the prose mentions as part of a 'sequence of simple selectors', is 'simple selectors'. But the prose definition of 'simple selector' doesn't include 'pseudo-element'. So, in the prose, 'pseudo-element' lives in a limbo.

Unlike the prose, however, the grammar does include pseudo-elements as part of a 'sequence of simple selectors'. See my previous message [1].

Now briefly about the prose. The CSS 3 selectors published working draft now says:

> > 4. Selector syntax
>   
> > A selector is a chain of one or more sequences of simple selectors
> > separated by combinators.
>   
Thus a selector may contain only
(a) a chain of one or more sequences of simple selectors, and
(b) zero or more combinators.

Thus a pseudo-element must be either a simple selector
or a combinator; no other syntactic category is permitted
by this rule.

Further:

> > A sequence of simple selectors is a chain of simple selectors that are
> > not separated by a combinator. It always begins with a type selector or
> > a universal selector. No other type selector or universal selector is
> > allowed in the sequence.
>   

Again, if a 'sequence of simple selectors' is 'a chain of simple selectors that are not separated by a combinator', then a pseudo-element itself has to be a simple selector. (As neither '::' nor the rest of the pseudo-element is a 'combinator'.)

Further:

> > 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.
>   

Needs clarification : in order to comply with rule (1), the result
of this appending must itself be a sequence of simple selectors;
the rule should clarify that this is indeed the case.

As a pseudo-element can occur nowhere else, we do (perhaps?) not need
to know whether or not it itself is a simple selector. But we do need
to know whether or not the sequence :

 <last sequence of simple selectors><pseudo element>

is itself a <sequence of simple selectors>.

[1] http://lists.w3.org/Archives/Public/www-style/2009Oct/0263
-- 
Leif Halvard Silli

Received on Thursday, 22 October 2009 13:22:18 UTC