From a6267199ff9aff503e05f968e9a850d3169e1d9c Mon Sep 17 00:00:00 2001 From: sndrs Date: Thu, 13 Jun 2013 17:56:42 +0100 Subject: [PATCH] logic mistake - restore checks for presence of '/' --- dist/all.js | 6 ++++-- src/htmlminifier.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dist/all.js b/dist/all.js index 30c5d22..2b4b676 100644 --- a/dist/all.js +++ b/dist/all.js @@ -386,11 +386,13 @@ // 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']; - if (prevTag && prevTag !== 'img' && (prevTag.substr(0,1) !== '/' || tags.indexOf(prevTag.substr(1)) === -1)) { + if (prevTag && prevTag !== 'img' && (prevTag.substr(0,1) !== '/' + || ( prevTag.substr(0,1) === '/' && tags.indexOf(prevTag.substr(1)) === -1))) { str = str.replace(/^\s+/, ''); } - if (nextTag && nextTag !== 'img' && (nextTag.substr(0,1) === '/' || tags.indexOf(nextTag) === -1)) { + if (nextTag && nextTag !== 'img' && (nextTag.substr(0,1) === '/' + || ( nextTag.substr(0,1) !== '/' && tags.indexOf(nextTag) === -1))) { str = str.replace(/\s+$/, ''); } diff --git a/src/htmlminifier.js b/src/htmlminifier.js index e48c321..ce064ca 100644 --- a/src/htmlminifier.js +++ b/src/htmlminifier.js @@ -44,11 +44,13 @@ // 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']; - if (prevTag && prevTag !== 'img' && (prevTag.substr(0,1) !== '/' || tags.indexOf(prevTag.substr(1)) === -1)) { + if (prevTag && prevTag !== 'img' && (prevTag.substr(0,1) !== '/' + || ( prevTag.substr(0,1) === '/' && tags.indexOf(prevTag.substr(1)) === -1))) { str = str.replace(/^\s+/, ''); } - if (nextTag && nextTag !== 'img' && (nextTag.substr(0,1) === '/' || tags.indexOf(nextTag) === -1)) { + if (nextTag && nextTag !== 'img' && (nextTag.substr(0,1) === '/' + || ( nextTag.substr(0,1) !== '/' && tags.indexOf(nextTag) === -1))) { str = str.replace(/\s+$/, ''); } -- 2.34.1