Browse Source

don't remove src with data URIs from scripts

Gildas 4 years ago
parent
commit
882af12596
1 changed files with 5 additions and 2 deletions
  1. 5 2
      lib/single-file/single-file-core.js

+ 5 - 2
lib/single-file/single-file-core.js

@@ -1200,10 +1200,8 @@ class Processor {
 			let scriptSrc;
 			if (element.tagName == "SCRIPT") {
 				scriptSrc = element.getAttribute("src");
-				element.removeAttribute("src");
 			} else {
 				scriptSrc = element.getAttribute("href");
-				element.removeAttribute("href");
 			}
 			element.removeAttribute("integrity");
 			element.textContent = "";
@@ -1213,6 +1211,11 @@ class Processor {
 				// ignored
 			}
 			if (testValidURL(resourceURL)) {
+				if (element.tagName == "SCRIPT") {
+					element.removeAttribute("src");
+				} else {
+					element.removeAttribute("href");
+				}
 				this.stats.add("processed", "scripts", 1);
 				const content = await util.getContent(resourceURL, {
 					asBinary: true,