images are a special case
authorsndrs <sndrs@me.com>
Thu, 13 Jun 2013 16:49:33 +0000 (17:49 +0100)
committersndrs <sndrs@me.com>
Thu, 13 Jun 2013 16:49:33 +0000 (17:49 +0100)
dist/all.js
src/htmlminifier.js

index b4dbd44..30c5d22 100644 (file)
 
   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', 'img', 'kbd', 'mark', 'q', 's', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'tt', 'u'];
+    var tags = ['a', 'b', 'big', 'button', 'code', 'em', 'font', 'i', 'kbd', 'mark', 'q', 's', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'tt', 'u'];
 
-    if (prevTag && (prevTag.substr(0,1) !== '/'
-      || ( prevTag.substr(0,1) === '/' && tags.indexOf(prevTag.substr(1)) === -1))) {
+    if (prevTag && prevTag !== 'img' && (prevTag.substr(0,1) !== '/' || tags.indexOf(prevTag.substr(1)) === -1)) {
       str = str.replace(/^\s+/, '');
     }
 
-    if (nextTag && (nextTag.substr(0,1) === '/'
-      || ( nextTag.substr(0,1) !== '/' && tags.indexOf(nextTag) === -1))) {
+    if (nextTag && nextTag !== 'img' && (nextTag.substr(0,1) === '/' || tags.indexOf(nextTag) === -1)) {
       str = str.replace(/\s+$/, '');
     }
 
index 352e5e5..e48c321 100644 (file)
 
   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', 'img', 'kbd', 'mark', 'q', 's', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'tt', 'u'];
+    var tags = ['a', 'b', 'big', 'button', 'code', 'em', 'font', 'i', 'kbd', 'mark', 'q', 's', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'tt', 'u'];
 
-    if (prevTag && (prevTag.substr(0,1) !== '/'
-      || ( prevTag.substr(0,1) === '/' && tags.indexOf(prevTag.substr(1)) === -1))) {
+    if (prevTag && prevTag !== 'img' && (prevTag.substr(0,1) !== '/' || tags.indexOf(prevTag.substr(1)) === -1)) {
       str = str.replace(/^\s+/, '');
     }
 
-    if (nextTag && (nextTag.substr(0,1) === '/'
-      || ( nextTag.substr(0,1) !== '/' && tags.indexOf(nextTag) === -1))) {
+    if (nextTag && nextTag !== 'img' && (nextTag.substr(0,1) === '/' || tags.indexOf(nextTag) === -1)) {
       str = str.replace(/\s+$/, '');
     }