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

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

From: Benjamin Poulain <bpoulain@apple.com>
Date: Tue, 16 Sep 2014 12:22:51 -0700
Cc: www-style list <www-style@w3.org>
Message-id: <41FA32D1-8BBE-4E18-B9E6-7C764FA36506@apple.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
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

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