public
/
html-minifier.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cf7bd9f
)
fix erroneous trailing whitespace detection
author
alexlamsl
<alexlamsl@gmail.com>
Fri, 16 Sep 2016 06:14:42 +0000
(14:14 +0800)
committer
alexlamsl
<alexlamsl@gmail.com>
Fri, 16 Sep 2016 06:14:42 +0000
(14:14 +0800)
fixes #713
src/htmlminifier.js
patch
|
blob
|
history
diff --git
a/src/htmlminifier.js
b/src/htmlminifier.js
index
2a6f3f7
..
a4b5442
100644
(file)
--- a/
src/htmlminifier.js
+++ b/
src/htmlminifier.js
@@
-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)) {