Explorar o código

more conservative whitespace removal

Gildas %!s(int64=7) %!d(string=hai) anos
pai
achega
bfad3a2244
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      lib/single-file/htmlnano.js

+ 5 - 1
lib/single-file/htmlnano.js

@@ -171,7 +171,11 @@ this.htmlnano = this.htmlnano || (() => {
 				let lastTextContent;
 				while (lastTextContent != textContent) {
 					lastTextContent = textContent;
-					textContent = textContent.replace(/( )+|(\n)+|(\t)+|(\f)+||(\r)+/g, "$1");
+					textContent = textContent.replace(/ +/g, " ");
+					textContent = textContent.replace(/\n+/g, "\n");
+					textContent = textContent.replace(/\t+/g, "\t");
+					textContent = textContent.replace(/\f+/g, "\f");
+					textContent = textContent.replace(/\r+/g, "\r");
 				}
 				node.textContent = textContent;
 			}