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

My proposal would be that both a `scope()` function in CSS `@import`, and a `scope` attribute on the `<link>` element could use accept the full `@scope` condition syntax:

```css
@import uri(module.css) scope((.media-object) to (.content) inclusive);
```
```html
<link rel="stylesheet" href="module.css" scope="(.media-object) to (.content) exclusive">
```

The only edge case that might warrant a special-case is importing a scope with _only the scope root_. Without any exceptions, that would result in double-parentheses:

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

---

I also want to recognize that adding attributes like this to HTML `<link>` also requires our proposed (but not yet fully specified or approved) update to the `<link media="">` attribute, so that it's possible to test for support of scoping, and only load the linked CSS file _if the scoping will be applied_. This is also needed for a proposed `layer` attribute.

There's a [PR in progress](https://github.com/whatwg/html/pull/7658/), but I could use help on some of the details.

-- 
GitHub Notification of comment by mirisuzanne
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7348#issuecomment-1248497389 using your GitHub account


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

Received on Thursday, 15 September 2022 19:08:24 UTC