single-file-core 1.5.37 → 1.5.39

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/index.js CHANGED
@@ -575,8 +575,10 @@ class Processor {
575
575
  }
576
576
  }
577
577
  const styleElement = this.doc.createElement("style");
578
- styleElement.textContent = "img[src=\"data:,\"],source[src=\"data:,\"]{display:none!important}";
579
- this.doc.head.appendChild(styleElement);
578
+ if (this.doc.querySelector("img[src=\"data:,\"],source[src=\"data:,\"]")) {
579
+ styleElement.textContent = "img[src=\"data:,\"],source[src=\"data:,\"]{display:none!important}";
580
+ this.doc.head.appendChild(styleElement);
581
+ }
580
582
  this.doc.head.querySelectorAll("noscript").forEach(element => element.parentElement.appendChild(element));
581
583
  let size;
582
584
  if (this.options.displayStats) {
@@ -136,7 +136,7 @@ function getProcessorHelperClass(utilInstance) {
136
136
  styleElement.remove();
137
137
  }
138
138
  });
139
- if (options.groupDuplicateStylesheets) {
139
+ if (options.groupDuplicateStylesheets && doc.querySelector("style[" + DUPLICATE_STYLESHEET_ATTRIBUTE_NAME + "]")) {
140
140
  const scriptElement = doc.createElement("script");
141
141
  scriptElement.textContent = "document.currentScript.remove();addEventListener(\"load\",()=>document.querySelectorAll(\"style[" + DUPLICATE_STYLESHEET_ATTRIBUTE_NAME + "]\").forEach(e=>e.remove()))";
142
142
  doc.body.appendChild(scriptElement);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.5.37",
3
+ "version": "1.5.39",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",