From b1c6014c50c5e7154616c51c691cd1f87de0c9b2 Mon Sep 17 00:00:00 2001 From: alexlamsl Date: Tue, 19 Jan 2016 23:19:39 +0800 Subject: [PATCH] avoid unnecessary work --- src/htmlminifier.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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; -- 2.34.1