瀏覽代碼

refactored fix related to SingleFile comment

Gildas 7 年之前
父節點
當前提交
7a44fc79ec
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 1 1
      lib/single-file/htmlmini.js
  2. 3 3
      lib/single-file/single-file-core.js

+ 1 - 1
lib/single-file/htmlmini.js

@@ -207,7 +207,7 @@ this.htmlmini = this.htmlmini || (() => {
 	}
 
 	function removeComments(node) {
-		if (node.nodeType == Node.COMMENT_NODE && !node.textContent.includes("SingleFile")) {
+		if (node.nodeType == Node.COMMENT_NODE) {
 			return !node.textContent.toLowerCase().trim().startsWith("[if");
 		}
 	}

+ 3 - 3
lib/single-file/single-file-core.js

@@ -111,9 +111,6 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 				this.processor.insertFaviconLink();
 			}
 			this.processor.resolveHrefs();
-			if (this.options.insertSingleFileComment) {
-				this.processor.insertSingleFileCommentNode();
-			}
 			this.processor.replaceCanvasElements();
 			if (this.options.removeHiddenElements) {
 				this.processor.removeHiddenElements();
@@ -158,6 +155,9 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			if (this.options.compressHTML) {
 				this.processor.compressHTML(true);
 			}
+			if (this.options.insertSingleFileComment) {
+				this.processor.insertSingleFileCommentNode();
+			}
 			this.processor.removeBase();
 		}