[WICG/webcomponents] [Proposal] Stylesheet Observer (Issue #1041)

It would be nice for a web component to be able to observe stylesheets as they are adopted or imported by the parent Shadow DOM scope or the root document, and pick and choose which ones to import.

So the basic shape would look like:

```TypeScript
const observer = new StyleSheetObserver(options: StyleSheetObserverOptions);
observer.addEventListener('stylesheetadded', e => {
    console.log(e.stylesheet);
});
observer.addEventListener('stylesheetremoved', e => {
    console.log(e.stylesheet);
});
observer.observe(shadowRoot);
observer.observe(document);
```

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

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

Received on Thursday, 21 December 2023 13:15:53 UTC