W3C home > Mailing lists > Public > www-style@w3.org > September 2014

Re: [selectors] :nth-child(An+B of selector) with a pseudo element

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 17 Sep 2014 12:47:47 -0700
Message-ID: <CAAWBYDD7gKntzRTBu81nP7bwoaXactrsu6YKmnToOMJnwuEzcg@mail.gmail.com>
To: Henrik Andersson <henke@henke37.cjb.net>
Cc: Benjamin Poulain <bpoulain@apple.com>, www-style list <www-style@w3.org>
On Wed, Sep 17, 2014 at 12:35 PM, Henrik Andersson
<henke@henke37.cjb.net> wrote:
> Benjamin Poulain skrev:
>> You cannot resolve style based on style being already resolved.
>> In you example:
>>     <p>A cat <img src="cat.jpg"> with a tail <img src="tail.jpg"></p>
>> you would have to resolve style, then layout to find it the selector should have matched when resolving style.
> That sounds like a problem that isn't unique to my example, but every
> single use of the ::first-line pseudo element!

Not quite.  ::first-line is indeed tricky, but it's just a matter of
the precise bounds being somewhat unclear; you have to resolve style
and find the bounds at the same time.  You can't then select based on
those bounds, though.

Note, though, that a selector like `:nth-child(2n+1 of
::first-letter)` is *not* selecting the 2n+1th children of a
::first-letter; instead, it's selecting the 2n+1th children of some
element, counting only the children that match ::first-letter.  That's
why I said these selectors will just never match, as pseudo-elements
aren't "children" and won't be counted that way in any case.

Received on Wednesday, 17 September 2014 19:48:34 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:46 UTC