From: Micky Hulse Date: Thu, 15 Aug 2013 05:06:01 +0000 (-0700) Subject: Added isIgnoredComment() X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=b1580b2763fd5b72e42e3212257a1201d7239c81;p=html-minifier.git Added isIgnoredComment() Patch for issue #70. --- 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 = '';