瀏覽代碼

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;
 			}