فهرست منبع

don't store imports if removed from the page

Gildas 6 سال پیش
والد
کامیت
87fbe8207f
1فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 4 2
      lib/single-file/single-file-core.js

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

@@ -941,7 +941,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 
 		async resolveHtmlImportURLs() {
 			const linkElements = Array.from(this.doc.querySelectorAll("link[rel=import][href]"));
-			if (!this.relImportProcessors) {
+			if (!this.relImportProcessors && !this.options.removeImports) {
 				this.relImportProcessors = new Map();
 			}
 			await Promise.all(linkElements.map(async linkElement => {
@@ -963,7 +963,9 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 					options.content = content;
 					if (!Util.testIgnoredPath(resourceURL) && Util.testValidPath(resourceURL)) {
 						const processor = new Runner(options);
-						this.relImportProcessors.set(linkElement, processor);
+						if (!this.options.removeImports) {
+							this.relImportProcessors.set(linkElement, processor);
+						}
 						await processor.loadPage();
 						await processor.initialize();
 						processor.processor.stylesheets.forEach(stylesheet => {