W3C home > Mailing lists > Public > www-style@w3.org > April 2012

Re: [selectors5] Proposal for a pseudo combinator

From: fantasai <fantasai.lists@inkedblade.net>
Date: Thu, 05 Apr 2012 16:13:37 -0700
Message-ID: <4F7E2721.8000105@inkedblade.net>
To: www-style@w3.org
On 04/05/2012 03:44 PM, Tab Atkins Jr. wrote:
> Right now, pseudo-elements are selected by appending a "::foo" to the
> end of a compound selector, as if it were any other simple selector.
> This syntax dates back from CSS1, when the only pseudo-elements were
> :first-line and :first-letter, which are heavily restricted in what
> properties they can take.  In many ways, these can be considered to
> not be elements at all, but rather simply a special way to apply
> properties to a subset of text.
>
> This changed with CSS2 and its introduction of ::before and ::after -
> these were completely unrestricted in the properties they could
> accept, and are generally identical to 'real' elements.  However, for
> consistency we stuck with the CSS1 syntax for pseudo-elements, only
> changing from a single colon to a double colon.
>
> This syntax has some drawbacks.  For one, it's unclear from the syntax
> that what you're actually selecting is a brand new element - this is
> usually indicated by the use of a combinator, but :: doesn't have the
> qualities of a combinator.

I don't see any benefit to solving this.

> For two, the syntax forces the pseudo-element to be at the end of the
> selector, which prevents us from filtering based on qualities of the
> pseudo-element, such as wanting to style it differently when hovered.
> (This is another legacy from CSS1, where there were no pseudo-classes
> that could possibly apply to pseudo-elements.)

This is a restriction that we can relax.

~fantasai
Received on Thursday, 5 April 2012 23:14:13 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:52 GMT