[csswg-drafts] [css-cascade-6] Add ability to scope rules from an imported stylesheet (#7348)

faceless2 has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-cascade-6] Add ability to scope rules from an imported stylesheet ==
This is following on from a brief conversation with @tabatkins at CSSDay.

While I like the scoping proposal, I think it really needs a way to scope styles from an imported stylesheet. As it is now you can define your scopes - great for modularization - but the rules have to be inline in the same sheet, which seems to defeat the purpose a bit to me.

There are several ways to do this - an `@import` inside a `@scope` is one, but I think for consistency with cascade layers the syntax should be like

```css
@import uri(module.css) scope(.media-object) to (.content);
```

Also useful but slightly more controversial (it doesn't have the desired behaviour when the attribute is not recognised) would be adding a `scope` and (pending a better idea) a `scope-to` attribute to `<link>`, the same way that it now has `layer` (see https://github.com/w3c/csswg-drafts/issues/5853)

```html
<link rel="stylesheet" href="module.css" scope=".media-object" scope-to=".content">
```





Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7348 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 11 June 2022 12:37:51 UTC