attrValue = attrValue.replace(/1\.0/g, '1').replace(/\s+/g, '');
}
else if (attrValue && options.customAttrCollapse && options.customAttrCollapse.test(attrName)) {
- attrValue = attrValue.replace(/\n+/g, '');
+ attrValue = attrValue.replace(/\n+|\r+|\s{2,}/g, '');
}
return attrValue;
}
equal(minify( input, { customAttrCollapse: /.+/ }), output);
});
+ test('custom attribute collapse with newlines, whitespace, and carriage returns', function(){
+ input = '<div ng-class="{ \n\r' +
+ ' value:true, \n\r'+
+ ' value2:false \n\r' +
+ ' }"></div>';
+ output = '<div ng-class="{value:true,value2:false}"></div>';
+
+ equal(minify( input, {customAttrCollapse: '/ng\-class/'}), output);
+ });
+
test('do not escape attribute value', function() {
input = '<div data=\'{\n' +
'\t"element": "<div class=\"test\"></div>\n"' +