Re: [whatwg/dom] Should there be a declarative version of adoptedStyleSheets? (#910)

Here’s an idea for what this might look like.

Inline CSS module:

```html
<style type="module">
  p { color: hotpink; }
</style>
```

External CSS module:

```html
<style type="module" src="external.css"></style>
```

By default it should be adopted by the document (into `document.adoptedStyleSheets`).

And then ideally there’s a declarative way to instantiate templates, which could be reused to also share CSS modules across shadow-roots (and with the document too).

```html
<template type="definition" id="foo">
  <style type="module" src="external.css"></style>
  <slot></slot>
</template>
```

```html
<my-component>
  <template shadowrootmode="open" from="foo"></template>
  <p>Hello</p>
</my-component>
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/910#issuecomment-2002310960
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/910/2002310960@github.com>

Received on Sunday, 17 March 2024 05:16:22 UTC