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

@scope #842

Closed
andruud opened this issue Oct 9, 2024 · 2 comments
Closed

@scope #842

andruud opened this issue Oct 9, 2024 · 2 comments
Labels
focus-area-proposal Focus Area Proposal

Comments

@andruud
Copy link

andruud commented Oct 9, 2024

Description

Allows authors to scope style rules to a given scoping root, and style elements according to the proximity of that scoping root.

Specification

https://drafts.csswg.org/css-cascade-6/#scoped-styles

Additional Signals

Standards Position

Firefox: Positive - mozilla/standards-positions#472
Safari: Positive - WebKit/standards-positions#13

Browser Bugs

Chromium (17 stars)
Mozilla

Tests

https://wpt.fyi/results/css/css-cascade?label=experimental&label=master&aligned&view=subtest&q=scope

Developer Surveys

It made the list of missing features in the State of CSS survey in 2019, 2020, and 2021. Featured in “missing features” list from state of CSS 2023

Workarounds

Scope being missing from CSS is one reason why developers lean on css-in-js libraries. These libraries can have poor performance characteristics when they parse styles as JS first, and then again as CSS.

  • Salesforce has written a custom tool that automatically prefixes all styles in a file with an additional unique class name.
  • Requested by Rich Harris, creator of Svelte, a framework with a lot of mindshare.
  • “Scope separate from templating” was also a request from Stencil/Ionic, a web components library.
  • BEM and OOCCS were designed to avoid the name collisions that come from overlapping styles, but both rely on developer vigilance to work.

Additional Signals

Use counter data - https://chromestatus.com/metrics/feature/timeline/popularity/4212

@andruud andruud added the focus-area-proposal Focus Area Proposal label Oct 9, 2024
@andruud
Copy link
Author

andruud commented Oct 9, 2024

Oh, looks like @miragecraft already opened an issue for this. Closing as duplicate of #838.

@andruud
Copy link
Author

andruud commented Oct 9, 2024

(Duplicate)

@andruud andruud closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus-area-proposal Focus Area Proposal
Projects
Status: Done
Development

No branches or pull requests

1 participant