From: alexlamsl Date: Tue, 19 Jan 2016 15:19:39 +0000 (+0800) Subject: avoid unnecessary work X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=b1c6014c50c5e7154616c51c691cd1f87de0c9b2;p=html-minifier.git avoid unnecessary work --- diff --git a/src/htmlminifier.js b/src/htmlminifier.js index e91b37e..e529632 100644 --- a/src/htmlminifier.js +++ b/src/htmlminifier.js @@ -405,6 +405,11 @@ attrValue = cleanAttributeValue(tag, attrName, attrValue, options, attrs); + if (options.removeEmptyAttributes && + canDeleteEmptyAttribute(tag, attrName, attrValue)) { + return ''; + } + if (attrValue !== undefined && !options.removeAttributeQuotes || !canRemoveAttributeQuotes(attrValue)) { emittedAttrValue = attrQuote + attrValue + attrQuote; @@ -417,11 +422,6 @@ emittedAttrValue = attrValue; } - if (options.removeEmptyAttributes && - canDeleteEmptyAttribute(tag, attrName, attrValue)) { - return ''; - } - if (attrValue === undefined || (options.collapseBooleanAttributes && isBooleanAttribute(attrName, attrValue))) { attrFragment = attrName;