single-file-core 1.0.63 → 1.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.0.63",
3
+ "version": "1.0.64",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -314,10 +314,12 @@
314
314
 
315
315
  addEventListener(GET_ADOPTED_STYLESHEETS_REQUEST_EVENT, event => {
316
316
  const shadowRoot = event.target.shadowRoot;
317
- const adoptedStyleSheets = Array.from(shadowRoot.adoptedStyleSheets).map(stylesheet => Array.from(stylesheet.cssRules).map(cssRule => cssRule.cssText).join("\n"));
318
- if (adoptedStyleSheets.length) {
319
- event.target.dispatchEvent(new CustomEvent(GET_ADOPTED_STYLESHEETS_RESPONSE_EVENT, { detail: { adoptedStyleSheets } }));
320
- }
317
+ if (shadowRoot) {
318
+ const adoptedStyleSheets = Array.from(shadowRoot.adoptedStyleSheets).map(stylesheet => Array.from(stylesheet.cssRules).map(cssRule => cssRule.cssText).join("\n"));
319
+ if (adoptedStyleSheets.length) {
320
+ event.target.dispatchEvent(new CustomEvent(GET_ADOPTED_STYLESHEETS_RESPONSE_EVENT, { detail: { adoptedStyleSheets } }));
321
+ }
322
+ }
321
323
  }, { capture: true });
322
324
 
323
325
  if (globalThis.FontFace) {