|
|
@@ -280,12 +280,11 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
|
|
|
if (doc) {
|
|
|
const contents = [];
|
|
|
doc.querySelectorAll("style").forEach((styleElement, styleIndex) => {
|
|
|
- let stylesheet;
|
|
|
try {
|
|
|
const tempStyleElement = doc.createElement("style");
|
|
|
tempStyleElement.textContent = styleElement.textContent;
|
|
|
doc.body.appendChild(tempStyleElement);
|
|
|
- stylesheet = tempStyleElement.sheet;
|
|
|
+ const stylesheet = tempStyleElement.sheet;
|
|
|
tempStyleElement.remove();
|
|
|
if (!stylesheet || stylesheet.cssRules.length != styleElement.sheet.cssRules.length) {
|
|
|
contents[styleIndex] = Array.from(styleElement.sheet.cssRules).map(cssRule => cssRule.cssText).join("\n");
|