Re: [selectors4][css-syntax] Pseudo-elements vs. combinators

On Feb 6, 2014, at 4:51 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Thu, Feb 6, 2014 at 1:29 PM, Peter Moulder
> <pjrm@mail.internode.on.net> wrote:
>> The CSS 2.1 parsing rules (section 4.1.7 paragraph 4 and following) say that if
>> any comma-separated component of a ruleset's selectors is not valid CSS 2.1,
>> then the whole ruleset must be dropped.  This seems to be true of css-syntax /
>> css-selectors-4 too (except that the comma-separated components have slightly
>> looser requirements than CSS 2.1, e.g. having some additional combinators).
>> 
>> This suggests that the best choice of <combinator-prefix> is actually ‘:’.
> 
> You're misreading that.  It's stricter than you're implying - using an
> unknown pseudo-class invokes the "doesn't match the grammar"
> condition.
> 
> So using : is no safer than using anything else.  (And it's way more
> confusing, given the double-duty it's already pulling as an indicator
> of pseudo-classes and pseudo-elements.)
> 
> The actual restrictions we're working under are just that the new
> syntax be compatible with CSS's general syntax, which pretty much only
> disallows using {, or using ( without a ).  (We can't use [ in any
> case, since it's already used for attr selectors, unless we do
> something weird like [[shadow]].)
> 

+1 to not overloading : or ::. Understanding the difference between them is something CSS beginners all go through (that legacy pseudo-elements/classes can be written with a single : does not help though that’s starting to abate). Overloading either to also be a combinator prefix sounds like it’d confuse just about everyone all over again, and make learning harder. (’::first-line and ::shadow are totally different kinds of things!’ ‘Uh?')

Received on Friday, 7 February 2014 03:05:09 UTC