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

Re: [css4-pseudo] multiple and nested pseudo-element ordering

From: <sam@cateches.is>
Date: Wed, 24 Apr 2013 14:19:39 -0400 (EDT)
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: "www-style list" <www-style@w3.org>
Message-ID: <1366827579.351929731@apps.rackspace.com>
What about my other suggestion, where we nest pseudo-elements?

>  .headline[data-content-level="premium"]::after(1) /* Icon */
>  .headline[data-content-level="premium"]::after(2)::after  /* Text */
>  .headline[data-content-type="video"] ::after(2) /* Icon */
>  .headline[data-content-type="video"] ::after(2)::after /* Text */

That way, we'd be able to later define 

.headline[data-content-level="premium"]::after(2)::after(2) 

as perhaps another icon or something without having to shift all of the ordinals over by 1.

-s

-----Original Message-----
From: "Tab Atkins Jr." <jackalmage@gmail.com>
Sent: Wednesday, April 24, 2013 1:59pm
To: "Sam L'ecuyer" <sam@cateches.is>
Cc: "www-style list" <www-style@w3.org>
Subject: Re: [css4-pseudo] multiple and nested pseudo-element ordering

On Tue, Apr 23, 2013 at 10:05 PM, Sam L'ecuyer <sam@cateches.is> wrote:
> Essentially, I'd *expect* that to output `Stock Prices Climb P premium V
> video` with the icon fonts applied.  However, I have two pseudo-elements of
> ordinal "1" and two of ordinal "2" so an implementation may want to output
> `Stock Prices Climb P V premium video`.

Yup, that doesn't work, because we can't treat each *rule* as defining
a different pseudo-element, because you may style the same
pseudo-element in multiple rules (for example, applying a :hover
rule).  The number there isn't just the ordinal, it's the *identity*.

> Perhaps, this should be overcome by
> changing the selectors to
>
> ..headline[data-content-level="premium"]::after(1)
> ..headline[data-content-level="premium"]::after(2)
> ..headline[data-content-type="video"]::after(3)
> ..headline[data-content-type="video"]::after(4)

Yes, you have to do something like this, and you have to simply be
aware of what level each thing is at.  There's no real way to deal
with this. :/

~TJ


Received on Wednesday, 24 April 2013 18:20:07 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 24 April 2013 18:20:07 UTC