else if (attrName === 'class') {
return collapseWhitespace(trimWhitespace(attrValue));
}
- else if (isUriTypeAttribute(attrName, tag)
- || isNumberTypeAttribute(attrName, tag)
- || attrName === 'style') {
+ else if (isUriTypeAttribute(attrName, tag) || isNumberTypeAttribute(attrName, tag)) {
return trimWhitespace(attrValue);
}
+ else if (attrName === 'style') {
+ return trimWhitespace(attrValue).replace(/\s*;\s*$/, '');
+ }
return attrValue;
}
equals(minify(input, { cleanAttributes: true }), output);
input = '<p style=" color: red; background-color: rgb(100, 75, 200); "></p>';
- output = '<p style="color: red; background-color: rgb(100, 75, 200);"></p>';
+ output = '<p style="color: red; background-color: rgb(100, 75, 200)"></p>';
+ equals(minify(input, { cleanAttributes: true }), output);
+
+ input = '<p style="font-weight: bold ; "></p>';
+ output = '<p style="font-weight: bold"></p>';
equals(minify(input, { cleanAttributes: true }), output);
});