For a project, I would like to access all adoptedStyleSheets that got passed to a document or shadow root. I don't have any reference to stylesheet itself in this scenario.
const sheet = new CSSStyleSheet();
someShadowRoot.adoptedStyleSheets = [ sheet ];
Is there any documented way to access or read the adoptedStyleSheets?
For more information, I'm talking about https://web.dev/constructable-stylesheets/
Simply printing the adoptedStyleSheets didn't work, so I did not proceed further. It turned out that iterating through the array did actually do the trick.
for (let i = 0; i < document.adoptedStyleSheets.length; i++) {
console.log(document.adoptedStyleSheets[i]);
}
Thanks to @Justinas for pointing out the obvious.