single-file-core 1.3.9 → 1.3.10

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/core/helper.js CHANGED
@@ -498,16 +498,18 @@ function getStylesheetsData(doc) {
498
498
  const contents = [];
499
499
  doc.querySelectorAll("style").forEach((styleElement, styleIndex) => {
500
500
  try {
501
- const tempStyleElement = doc.createElement("style");
502
- tempStyleElement.textContent = styleElement.textContent;
503
- doc.body.appendChild(tempStyleElement);
504
- const stylesheet = tempStyleElement.sheet;
505
- tempStyleElement.remove();
506
- const textContentStylesheet = Array.from(stylesheet.cssRules).map(cssRule => cssRule.cssText).join("\n");
507
- const sheetStylesheet = Array.from(styleElement.sheet.cssRules).map(cssRule => cssRule.cssText).join("\n");
508
- if (!stylesheet || textContentStylesheet != sheetStylesheet) {
509
- styleElement.setAttribute(STYLESHEET_ATTRIBUTE_NAME, styleIndex);
510
- contents[styleIndex] = Array.from(styleElement.sheet.cssRules).map(cssRule => cssRule.cssText).join("\n");
501
+ if (!styleElement.sheet.disabled) {
502
+ const tempStyleElement = doc.createElement("style");
503
+ tempStyleElement.textContent = styleElement.textContent;
504
+ doc.body.appendChild(tempStyleElement);
505
+ const stylesheet = tempStyleElement.sheet;
506
+ tempStyleElement.remove();
507
+ const textContentStylesheet = Array.from(stylesheet.cssRules).map(cssRule => cssRule.cssText).join("\n");
508
+ const sheetStylesheet = Array.from(styleElement.sheet.cssRules).map(cssRule => cssRule.cssText).join("\n");
509
+ if (!stylesheet || textContentStylesheet != sheetStylesheet) {
510
+ styleElement.setAttribute(STYLESHEET_ATTRIBUTE_NAME, styleIndex);
511
+ contents[styleIndex] = Array.from(styleElement.sheet.cssRules).map(cssRule => cssRule.cssText).join("\n");
512
+ }
511
513
  }
512
514
  } catch (error) {
513
515
  // ignored
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.3.9",
3
+ "version": "1.3.10",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -138,7 +138,7 @@ async function extract(content, { password, prompt = () => { }, shadowRootScript
138
138
  }));
139
139
  await zipReader.close();
140
140
  indexPages.sort(sortByFilenameLength);
141
- resources = resources.concat(...indexPages);
141
+ resources = resources.reverse().concat(...indexPages);
142
142
  for (const resource of resources) {
143
143
  let { textContent, mimeType, filename } = resource;
144
144
  if (textContent !== undefined) {