Kaynağa Gözat

more conservative whitespace removal

Gildas 7 yıl önce
ebeveyn
işleme
bfad3a2244
1 değiştirilmiş dosya ile 5 ekleme ve 1 silme
  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;
 				let lastTextContent;
 				while (lastTextContent != textContent) {
 				while (lastTextContent != textContent) {
 					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;
 				node.textContent = textContent;
 			}
 			}