Skip to content

Commit

Permalink
On par with clean-css 1.1.6.
Browse files Browse the repository at this point in the history
* Fixes broken processing of irregular CSS.
  • Loading branch information
Jakub Pawlowicz committed Oct 26, 2013
1 parent 944a397 commit 435976e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions clean-css.js
Expand Up @@ -10,7 +10,7 @@ var options = {
};
var cleanOptions = {};
var fromStdin = !process.env['__DIRECT__'] && !process.stdin.isTTY;
var version = "1.1.5";
var version = "1.1.6";

// Arguments parsing (to drop optimist dependency)
var argv = process.argv.slice(2);
Expand Down Expand Up @@ -899,7 +899,11 @@ var CleanCSS = {
// strip parentheses in attribute values
replace(/\[([^\]]+)\]/g, function(match, content) {
var eqIndex = content.indexOf('=');
if (eqIndex < 0 && content.indexOf('\'') < 0 && content.indexOf('"') < 0)
var singleQuoteIndex = content.indexOf('\'');
var doubleQuoteIndex = content.indexOf('"');
if (eqIndex < 0 && singleQuoteIndex < 0 && doubleQuoteIndex < 0)
return match;
if (singleQuoteIndex === 0 || doubleQuoteIndex === 0)
return match;

var key = content.substring(0, eqIndex);
Expand Down
2 changes: 1 addition & 1 deletion test/binary-test.js
Expand Up @@ -49,7 +49,7 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({
}),
'version': binaryContext('-v', {
'should output help': function(error, stdout) {
assert.equal(stdout, "1.1.5\n");
assert.equal(stdout, "1.1.6\n");
}
}),
'stdin': pipedContext("a{color: #f00}", '', {
Expand Down

0 comments on commit 435976e

Please sign in to comment.