Comparing version 1.4.1 to 1.5.0
@@ -19,3 +19,4 @@ 'use strict'; | ||
quotes: false, // remove(false) or retain(true) quotes if not required | ||
loose: false // remove(false) all or retain(true) one whitespace | ||
loose: false, // remove(false) all or retain(true) one whitespace | ||
whitespace: false // remove(false) or retain(true) whitespace in attributes | ||
}; | ||
@@ -153,3 +154,3 @@ | ||
// | ||
return result + '=' + self.quote(compact(value).trim()); | ||
return result + '=' + self.quote(!self.config.whitespace ? compact(value).trim() : value); | ||
}, ''); | ||
@@ -156,0 +157,0 @@ }; |
{ | ||
"name": "minimize", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "Minimize HTML", | ||
@@ -5,0 +5,0 @@ "main": "./lib/minimize", |
@@ -27,2 +27,3 @@ { | ||
"conditionalcomments": "<head><!--[if IE 6]>Special instructions for IE 6 here<![endif]--></head><h1><!-- Some comments thats either removed or kept --></h1>", | ||
"whitespace": "<input value=\" with newlines \n and whitespace\">", | ||
"doctype": { | ||
@@ -29,0 +30,0 @@ "data": "!doctype html", |
@@ -160,2 +160,10 @@ 'use strict'; | ||
it('should be configurable to retain whitespace and newlines of attributes', function (done) { | ||
var whitespace = new Minimize({ whitespace: true }); | ||
whitespace.parse(html.whitespace, function (error, result) { | ||
expect(result).to.equal('<input value=\" with newlines \n and whitespace\">'); | ||
done(); | ||
}); | ||
}); | ||
it('should leave structural elements (like scripts and code) intact', function (done) { | ||
@@ -271,2 +279,10 @@ minimize.parse(html.code, function (error, result) { | ||
it('should keep empty attribute values with if empty and spare options are set', function (done) { | ||
var empty = new Minimize({ empty: true, spare: true }); | ||
empty.parse('<option value="">Select something</option>', function (error, result) { | ||
expect(result).to.equal('<option value="">Select something</option>'); | ||
done(); | ||
}); | ||
}); | ||
it('should be configurable to retain CDATA', function (done) { | ||
@@ -273,0 +289,0 @@ var cdata = new Minimize({ cdata: true }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79912
1625