Skip to content

[selectors-4] Should *all* functional pseudo-classes pass restrictions to selector arguments? #12718

@cdoublev

Description

@cdoublev

If I am not mistaken, :has(), :nth-*-child(), :current(), host-*(), are the only functional pseudo-classes taking a selector as their arguments, that are not logical pseudo-classes.

I suspect they should pass any restrictions on validity of selectors at their position to their arguments, like logical pseudo-classes. Otherwise, these cases would be valid:

  • ::slotted(:has(type)) (valid in FF)
  • ::slotted(:nth-child(1 of :hover > :hover)) (valid in Chrome)
  • :host(:has(type)) (valid in FF)
  • :host(:nth-child(1 of :hover > :hover)) (valid in Chrome)

This is surprising because the following cases are invalid per spec and in Chrome/FF:

  • ::slotted(* > type)
  • ::slotted(:hover > :hover:nth-child(1))
  • :host(type > type)
  • :host(:hover > :hover:nth-child(1))

::slotted() and :host-*() take compound selectors, but has() takes relative selectors and :nth-*-child() takes complex selectors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions