From c0f4b84867851e647fabe35ad16909a476b40e91 Mon Sep 17 00:00:00 2001 From: alexlamsl Date: Thu, 3 Mar 2016 01:49:49 +0800 Subject: [PATCH] clarify squashTrailingWhitespace() --- dist/htmlminifier.js | 6 +++++- src/htmlminifier.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) 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])) { -- 2.34.1