Procházet zdrojové kódy

only remove elements

Gildas před 6 roky
rodič
revize
24c764c333
1 změnil soubory, kde provedl 5 přidání a 3 odebrání
  1. 5 3
      lib/single-file/single-file-core.js

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

@@ -548,9 +548,11 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			}
 
 			function removeNode(node) {
-				const tagName = node.tagName && node.tagName.toLowerCase();
-				if (tagName != "svg" && tagName != "style" && tagName != "link") {
-					node.remove();
+				if (node.nodeType == 1) {
+					const tagName = node.tagName && node.tagName.toLowerCase();
+					if (tagName != "svg" && tagName != "style" && tagName != "link") {
+						node.remove();
+					}
 				}
 			}
 		}