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

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.

~TJ

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