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

On Sep 16, 2014, at 11:20 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> On Mon, Sep 15, 2014 at 8:19 PM, Benjamin Poulain <bpoulain@apple.com> wrote:
>> Hi,
>> 
>> Currently, :nth-child() does not restrict pseudo-elements like :not() does. Shouldn’t it have the same restrictions?
>> 
>> For example:
>>    :nth-child(2n of ::after)
>>    :nth-child(2n+1 of ::first-letter)
>> do not make much sense.
> 
> It's not actually necessary to restrict it; :nth-child() only applies
> to elements, and only counts elements, so using a pseudo-element in
> the selector argument just won't match anything.

At the moment, I have used a parsing error for WebKit, similar to :not(). I believe being explicit is more useful than ignoring it silently.

Why should pseudo elements fail silently here and explicitly in :not()?

Benjamin

Received on Tuesday, 16 September 2014 19:25:37 UTC