From b1580b2763fd5b72e42e3212257a1201d7239c81 Mon Sep 17 00:00:00 2001 From: Micky Hulse Date: Wed, 14 Aug 2013 22:06:01 -0700 Subject: [PATCH] Added isIgnoredComment() Patch for issue #70. --- dist/all.js | 8 +++++++- src/htmlminifier.js | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dist/all.js b/dist/all.js index 4268f53..c702659 100644 --- a/dist/all.js +++ b/dist/all.js @@ -386,7 +386,7 @@ function collapseWhitespaceSmart(str, prevTag, nextTag) { // array of tags that will maintain a single space outside of them - var tags = ['a', 'b', 'big', 'button', 'code', 'em', 'font', 'i', 'kbd', 'mark', 'q', 's', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'tt', 'u']; + var tags = ['a', 'abbr', 'acronym', 'b', 'big', 'button', 'code', 'del', 'dfn', 'em', 'font', 'i', 'ins', 'kbd', 'mark', 'q', 's', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'tt', 'u', 'var']; if (prevTag && prevTag !== 'img' && (prevTag.substr(0,1) !== '/' || ( prevTag.substr(0,1) === '/' && tags.indexOf(prevTag.substr(1)) === -1))) { @@ -410,6 +410,10 @@ return ((/\[if[^\]]+\]/).test(text) || (/\s*('; + } else if (isIgnoredComment(text)) { + text = ''; } else { text = ''; diff --git a/src/htmlminifier.js b/src/htmlminifier.js index b4bced9..bf38f30 100644 --- a/src/htmlminifier.js +++ b/src/htmlminifier.js @@ -66,6 +66,10 @@ return ((/\[if[^\]]+\]/).test(text) || (/\s*('; + } else if (isIgnoredComment(text)) { + text = ''; } else { text = ''; -- 2.34.1