Re: [WICG/webcomponents] Declarative CSS Module Scripts (#939)

Being `<template shadowroot="open">` creates a shadow root that ID resolution from above does not have access to, should the "expected" version of:
```
  <my-element>
    <template shadowroot="open" adopted-styles="x61h8cys">
      <style type="adopted-css" xid="x61h8cys">
        :host {
          color: red
         }
      </style>
      <!-- ... -->
    </template>
  </my-element>
```
Actually be:
```
  <style type="adopted-css" id="x61h8cys">
    :host {
      color: red
     }
  </style>
  <my-element>
    <template shadowroot="open" adopted-styles="x61h8cys">
      <!-- ... -->
    </template>
  </my-element>
```
In this wa `x61h8cys` can be made available for other shadow roots without having to penetrate otherwise encapsulated DOM structures? Or do you think that _all_ `style[type="adopted-css"]` would be made available globally by default? 

How would you make these "declarative CSS modules" available in an imperative context? Should there be API to allow for resolution of the actual Stylesheet object from the `x61h8cys` identifier so that it can be adopted by shadow roots deeper within the DOM hierarchy or that might not be delivered declaratively?

Inversely, should stylesheets that are registered imperatively have API added by which to associate an ID (a la `adopted-styles="x61h8cys"`) so that they could be leveraged in declarative code?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/939#issuecomment-1003155180
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/939/1003155180@github.com>

Received on Thursday, 30 December 2021 19:28:38 UTC