Comparing version 0.5.13 to 0.5.14
@@ -77,3 +77,4 @@ 'use strict'; | ||
return (/[\s=]+/).test(value) || this.config.quotes | ||
// Always quote attributes having spaces or ending in a slash. | ||
return value.slice(-1) === '/' || (/[\s=]+/).test(value) || this.config.quotes | ||
? '"' + value + '"' | ||
@@ -132,3 +133,3 @@ : value; | ||
if (!self.config.empty && !retain.test(key) && !bool && !value) return result; | ||
// Boolean attributes should be adde sparse. | ||
// Boolean attributes should be added sparse. | ||
if (!self.config.spare && bool) return result + ' ' + key; | ||
@@ -135,0 +136,0 @@ // Return full attribute with value. |
{ | ||
"name": "minimize", | ||
"version": "0.5.13", | ||
"version": "0.5.14", | ||
"description": "Minimize HTML", | ||
@@ -10,11 +10,11 @@ "main": "./lib/minimize", | ||
"dependencies": { | ||
"htmlparser2": "3.3.x", | ||
"utile": "0.2.x" | ||
"htmlparser2": "~3.4.0", | ||
"utile": "~0.2.1" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.13.x", | ||
"chai": "1.8.x", | ||
"sinon": "1.7.x", | ||
"sinon-chai": "2.4.x", | ||
"pre-commit": "0.0.x" | ||
"mocha": "~1.17.1", | ||
"chai": "~1.8.1", | ||
"sinon": "~1.7.3", | ||
"sinon-chai": "~2.4.0", | ||
"pre-commit": "0.0.4" | ||
}, | ||
@@ -21,0 +21,0 @@ "repository": "git@github.com:Moveo/minimize.git", |
@@ -183,2 +183,6 @@ /*global beforeEach, afterEach*/ | ||
it('should always quote an attribute ending with /', function () { | ||
expect(helpers.quote('path/')).to.be.equal('"path/"'); | ||
}); | ||
it('should add quotes to attributes with spaces or =', function () { | ||
@@ -185,0 +189,0 @@ expect(helpers.quote(html.attribs.class)).to.be.equal('"some classes with spaces"'); |
@@ -153,3 +153,3 @@ 'use strict'; | ||
minimize.parse(html.full, function (error, result) { | ||
expect(result).to.equal("<!doctype html><html class=no-js><head></head><body class=container><section class=navigation id=navigation><nav class=row><h1><a href=/ class=logo title=\"Back to the homepage\">Nodejitsu</a></h1> <a href=#navigation class=\"mobile btn ss-rows\"></a> <a href=/paas>Cloud</a> <a href=/enterprise/private-cloud>Enterprise</a></nav></section><input type=text name=temp></body></html>"); | ||
expect(result).to.equal("<!doctype html><html class=no-js><head></head><body class=container><section class=navigation id=navigation><nav class=row><h1><a href=\"/\" class=logo title=\"Back to the homepage\">Nodejitsu</a></h1> <a href=#navigation class=\"mobile btn ss-rows\"></a> <a href=/paas>Cloud</a> <a href=/enterprise/private-cloud>Enterprise</a></nav></section><input type=text name=temp></body></html>"); | ||
done(); | ||
@@ -194,2 +194,10 @@ }); | ||
}); | ||
it('should always quote attributes that end with / regardless of options', function (done) { | ||
var quote = new Minimize({ quotes: false }); | ||
quote.parse('<a href="#/">test</a>', function (error, result) { | ||
expect(result).to.equal('<a href="#/">test</a>'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -196,0 +204,0 @@ |
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
52301
1111
+ Addeddomhandler@2.2.1(transitive)
+ Addeddomutils@1.3.0(transitive)
+ Addedhtmlparser2@3.4.0(transitive)
+ Addedreadable-stream@1.1.14(transitive)
- Removeddomhandler@2.1.0(transitive)
- Removeddomutils@1.1.6(transitive)
- Removedhtmlparser2@3.3.0(transitive)
- Removedreadable-stream@1.0.34(transitive)
Updatedhtmlparser2@~3.4.0
Updatedutile@~0.2.1