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

Support @scope rule #566

Closed
yisibl opened this issue Aug 18, 2023 · 0 comments · Fixed by #586
Closed

Support @scope rule #566

yisibl opened this issue Aug 18, 2023 · 0 comments · Fixed by #586

Comments

@yisibl
Copy link
Contributor

yisibl commented Aug 18, 2023

Describe the feature

Chrome 118 is shipping soon, which is expected to be one of the more popular CSS features, giving new hope for style isolation of components.

Example:

<style>
  @scope (.foo) to (.limit) {
    .green { background-color: green; }
  }
</style>

<div class=foo>
  <div class=green>Green</div>
  <div class=limit>
      <div class=green>Not green (within .foo, but below .limit)</div>
  </div>
</div>

<div class=green>Not green (not within .foo)</div>

Authors can also automatically scope the styles to <style>’s parent element by dropping the selector(s) in @scope’s prelude:

<div>
  <style>
    @scope {
      .green { background-color: green; }
    }
  </style>
  <div class=green>Green</div>
</div>

<div class=green>Not green</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant