[csswg-drafts] [selectors] Disallow standalone pseudo-elements in `:nth-*-child()` (#8212)

cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts:

== [selectors] Disallow standalone pseudo-elements in `:nth-*-child()` ==
`::before:nth-child(1)` is currently invalid. This is defined in a non-normative note for pseudo-classing in [Selectors 4](https://drafts.csswg.org/selectors-4/#pseudo-element-states):

> Note that, unless otherwise specified in a future specification, pseudo-classes other than the user action pseudo-classes are not valid when compounded to a pseudo-element; so, for example, `::before:first-child` is an invalid selector.

There is a [resolution](https://github.com/w3c/csswg-drafts/issues/7085#issuecomment-1325456381) to allow more pseudo-classes following a pseudo-element, but `:nth-*-child()` are not included.

I think pseudo-elements that are not associated to an originating pseudo-element should be invalid before/in `:nth-*-child()`, since `:nth-child(1 of ::before)` or `*:nth-child(1 of *::before)` (explicit) are equivalent to `::before:nth-child(1)`.

`:nth-*-child()` has been deferred to Selectors 5 in #3760 with the following resolution: *defer complex selectors for all of these selectors and have a note in the current level mentioning this is an enhancement we'll get to in the next level*. I do not see any mention of this in Selectors 4, maybe because it is already implemented in some browsers? I am not sure there are good use cases for using a pseudo-element as the subject or an argument of `:nth-*-child()` at the moment though.

I am not sure the concept of a pseudo-element defined with an internal structure will remain in Selectors 5, but I think a pseudo-element that can appear in such pseudo-element would also be valid in `:nth-*-child()`.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8212 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 9 December 2022 13:34:50 UTC