Sfoglia il codice sorgente

replaced unneeded === with ==

Gildas 7 anni fa
parent
commit
cc9c5ffcdd
2 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 2 2
      lib/single-file/htmlmini.js
  2. 1 1
      lib/single-file/single-file-core.js

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

@@ -189,7 +189,7 @@ this.htmlmini = this.htmlmini || (() => {
 	function collapseWhitespace(node, options) {
 		if (node.nodeType == Node.TEXT_NODE) {
 			let element = node.parentElement;
-			const spacePreserved = element.getAttribute(options.preservedSpaceAttributeName) === "";
+			const spacePreserved = element.getAttribute(options.preservedSpaceAttributeName) == "";
 			let textContent = node.textContent;
 			let noWhitespace = !spacePreserved && noWhitespaceCollapse(element);
 			while (noWhitespace) {
@@ -217,7 +217,7 @@ this.htmlmini = this.htmlmini || (() => {
 			Array.from(node.attributes).forEach(attribute => {
 				if (safeToRemoveAttrs.includes(attribute.name.toLowerCase())) {
 					const attributeValue = node.getAttribute(attribute.name);
-					if (attributeValue === "" || (attributeValue || "").match(/^\s+$/)) {
+					if (attributeValue == "" || (attributeValue || "").match(/^\s+$/)) {
 						node.removeAttribute(attribute.name);
 					}
 				}

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

@@ -660,7 +660,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 
 		static isolateElements(rootElement) {
 			rootElement.querySelectorAll("*").forEach(element => {
-				if (element.getAttribute(SELECTED_CONTENT_ATTRIBUTE_NAME) === "") {
+				if (element.getAttribute(SELECTED_CONTENT_ATTRIBUTE_NAME) == "") {
 					element.removeAttribute(SELECTED_CONTENT_ATTRIBUTE_NAME);
 				} else if (!element.querySelector("[" + SELECTED_CONTENT_ATTRIBUTE_NAME + "]")) {
 					element.remove();