Skip to content

[css-cascade-6] reusable named scopes #10336

@mayank99

Description

@mayank99

(This was originally posted in #9742 (comment) but moved to its own issue later.)

Proposal:

A scope statement, similar to a layer statement, could be used to create a reusable named scope. For example:

@scope foo (.start) to (.end);

A reusable named scope can then be used without specifying <scope-start>/<scope-end>:

@scope foo {
  p { color: red; }
}

The main thing this enables is avoiding the need to repeat selectors for every use.


Open questions:

  • how do we handle duplicate scope names?
  • how do we differentiate between named scopes and reusable named scopes? (different syntax?)

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