Skip to content

Commit

Permalink
fix erroneous trailing whitespace detection
Browse files Browse the repository at this point in the history
fixes #713
  • Loading branch information
alexlamsl committed Sep 16, 2016
1 parent cf7bd9f commit 85b34b4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/htmlminifier.js
Expand Up @@ -1138,7 +1138,11 @@ function minify(value, options, partialMarkup) {
if (prevTag) {
if (prevTag === '/nobr' || prevTag === 'wbr') {
if (/^\s/.test(text)) {
trimTrailingWhitespace(buffer.length - 2, 'br');
var tagIndex = buffer.length - 1;
while (tagIndex > 0 && buffer[tagIndex].lastIndexOf('<' + prevTag) !== 0) {
tagIndex--;
}
trimTrailingWhitespace(tagIndex - 1, 'br');
}
}
else if (inlineTextTags(prevTag.charAt(0) === '/' ? prevTag.slice(1) : prevTag)) {
Expand Down

0 comments on commit 85b34b4

Please sign in to comment.