Преглед изворни кода

more conservative whitespace removal

Gildas пре 7 година
родитељ
комит
bfad3a2244
1 измењених фајлова са 5 додато и 1 уклоњено
  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;
 			}