From: alexlamsl Date: Wed, 2 Mar 2016 17:49:49 +0000 (+0800) Subject: clarify squashTrailingWhitespace() X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=c0f4b84867851e647fabe35ad16909a476b40e91;p=html-minifier.git clarify squashTrailingWhitespace() --- diff --git a/dist/htmlminifier.js b/dist/htmlminifier.js index 6a5879a..377e3d3 100644 --- a/dist/htmlminifier.js +++ b/dist/htmlminifier.js @@ -1324,9 +1324,13 @@ buffer.length = Math.max(0, index); } + // look for trailing whitespaces from previously processed text + // which may not be trimmed due to a following comment or an empty + // element which has now been removed function squashTrailingWhitespace(nextTag) { var charsIndex; - if (buffer.length > 1 && /^(?: 1 && /^(?: 0 && /\s$/.test(buffer[buffer.length - 1])) { diff --git a/src/htmlminifier.js b/src/htmlminifier.js index 9eabd4e..3298cd2 100644 --- a/src/htmlminifier.js +++ b/src/htmlminifier.js @@ -784,9 +784,13 @@ buffer.length = Math.max(0, index); } + // look for trailing whitespaces from previously processed text + // which may not be trimmed due to a following comment or an empty + // element which has now been removed function squashTrailingWhitespace(nextTag) { var charsIndex; - if (buffer.length > 1 && /^(?: 1 && /^(?: 0 && /\s$/.test(buffer[buffer.length - 1])) {