Re: [csswg-drafts] [css-scoping] Please bring back scoped styles (#3547)

> @ExE-Boss Let only those who still write sites with IE6 compatibility worry about that. They can simply not use `<style scoped>` if they don't want to.

Note that a `<style scoped>` approach would also affect all _current_ browsers until they implement that feature and those versions get adopted. Without support, the website layout is broken.

>> have to be repeated in the HTML
> It's not something I should bother about when creating DOM dynamically, IMHO.

You definitely should, maybe not for two or three `<style scoped>`, but that doesn't scale well. If you have a significant amount of them on a page, the size of the HTML gets bloated and the parsing performance decreases much faster than with centralized solution.

Another idea related to the `@scope` rule in combination with HTML is to introduce a `scope` attribute naming the scope. The `@scope` rule then matches that name.

p { color: blue; }
@scope main {
  p { color: green; }
@scope note {
  p { color: gray; }
<p>This text is blue</p>
<section scope="main">
  <p>This text is green</p>
  <div scope="note">
    <p>This text is gray</p>
<div scope="note">
  <p>This text is gray</p>


GitHub Notification of comment by SebastianZ
Please view or discuss this issue at using your GitHub account

Sent via github-notify-ml as configured in

Received on Tuesday, 15 September 2020 23:00:05 UTC