Browse Source

simplified implementation

Gildas 7 years ago
parent
commit
08a81ffd2e
1 changed files with 2 additions and 7 deletions
  1. 2 7
      lib/single-file/htmlmini.js

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

@@ -186,13 +186,8 @@ this.htmlmini = this.htmlmini || (() => {
 				element = element.parentElement;
 				noWhitespace = element && noWhitespaceCollapse(element);
 			}
-			if ((!element || noWhitespace) && textContent.match(/\s+/) && textContent.length > 1) {
-				let lastTextContent;
-				while (lastTextContent != textContent) {
-					lastTextContent = textContent;
-					textContent = textContent.replace(/[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+/g, " ");
-				}
-				node.textContent = textContent;
+			if ((!element || noWhitespace) && textContent.length > 1) {
+				node.textContent = textContent.replace(/[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+/g, " ");
 			}
 		}
 	}