Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-cascade-6] grouping multiple scopes #10093

Open
mayank99 opened this issue Mar 16, 2024 · 0 comments
Open

[css-cascade-6] grouping multiple scopes #10093

mayank99 opened this issue Mar 16, 2024 · 0 comments

Comments

@mayank99
Copy link

mayank99 commented Mar 16, 2024

Currently there is no way to apply a set of rules to multiple scopes without duplication. <scope-start> and <scope-end> can be forgiving selector lists, but they create a single scope.

It would be useful to create multiple scopes at the same time. For example:

@scope (.scope1) to (.scope-1-end), (.scope2-start) to (.scope2-end), (.scope3) {
  p { color: hotpink; }
}

roughly equivalent to:

@scope (.scope1) to (.scope-1-end) {
  p { color: hotpink; }
}
@scope (.scope2-start) to (.scope2-end) {
  p { color: hotpink; }
}
@scope (.scope3) {
  p { color: hotpink; }
}

The main benefit is avoiding duplication (which is tedious and error-prone).

There may also be another benefit around avoiding cascade conflicts/ambiguity, which will be resolved solely through scope proximity. I'd imagine there would need to be a concept of "nearest active scope" within a group of scopes.


This should play nicely with some other existing proposals, including named scopes, scope() in @import/<link> and stylesheet conditions.

@mirisuzanne mirisuzanne added this to Relevant History in Cascade 6 (Scope) Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Cascade 6 (Scope)
Relevant History
Development

No branches or pull requests

2 participants