Re: [csswg-drafts] Support for building an optimal, nested CSSStylesheet programmatically (#13367)

Alternatively, given it's possible now to [scope a style sheet to a root](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@scope#syntax), could we instead have *per element* `.adoptedStyleSheets` and simply re-use `:scope`?

```ts
const sheet = new CSSStyleSheet();
sheet.replaceSync(`
    /* Works as both a direct style sheet and shadow root sheet */
    :scope, :host {
        /* custom element styles */
    }
`);

element.adoptedStyleSheets = [sheet];
```

This would be useful even beyond custom elements as you could create more complicated sheets than those that are supported by `style` attributes alone.

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


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

Received on Monday, 19 January 2026 15:14:01 UTC