Skip to content

[css-selectors] Allow relative selectors everywhere #8010

@romainmenke

Description

@romainmenke

A significant motivation behind changing the nesting syntax was making selectors easier to copy/paste between contexts.

This changed .foo { & .bar{} } into .foo { .bar{} }
Both .foo and .bar can be copy/pasted to any other context, or could have been copy/pasted from any other context.

.foo { > .bar{} } however can not be copied to the root of the stylesheet.

/* invalid */
> .bar{}

Currently I think it is only allowed in :

  • @scope
  • nested context
  • :has()

#7854 (comment)

Can > .bar{} be equal to :scope > .bar{} in all contexts?

All the pseudo's that accept selectors will need to be defined :

  • :is(> .foo)
  • :host(> .foo)
  • ...

Maybe :scope is not suitable everywhere?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions