From: Jakub Pawlowicz Date: Sat, 2 Aug 2014 10:01:06 +0000 (+0100) Subject: Fixes #332 - background shorthand with none and color at the end (per spec). X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=81ccb0f881868ecd2f2591f8078e925828900617;p=clean-css.git Fixes #332 - background shorthand with none and color at the end (per spec). --- diff --git a/History.md b/History.md index c3c79b34..1a9ba6ba 100644 --- a/History.md +++ b/History.md @@ -3,6 +3,7 @@ * Fixed issue with tokenizer removing first selector after an unknown @ rule. * Fixed issue [#329](https://github.com/GoalSmashers/clean-css/issues/329) - font shorthands incorrectly processed. +* Fixed issue [#332](https://github.com/GoalSmashers/clean-css/issues/332) - background shorthand with colors. * Refixed issue [#325](https://github.com/GoalSmashers/clean-css/issues/325) - invalid charset declarations. [2.2.11 / 2014-07-28](https://github.com/GoalSmashers/clean-css/compare/v2.2.10...v2.2.11) diff --git a/lib/properties/processable.js b/lib/properties/processable.js index 46016606..edb3a00a 100644 --- a/lib/properties/processable.js +++ b/lib/properties/processable.js @@ -217,7 +217,7 @@ module.exports = (function () { var sizeValue = new Splitter('/').split(currentPart); size.value = sizeValue.pop(); position.value = sizeValue.pop(); - } else if (validator.isValidColor(currentPart)) { + } else if ((color.value == processable[color.prop].defaultValue || color.value == 'none') && validator.isValidColor(currentPart)) { color.value = currentPart; } else if (validator.isValidUrl(currentPart) || validator.isValidFunction(currentPart)) { image.value = currentPart; diff --git a/test/unit-test.js b/test/unit-test.js index fc5ba6bd..73b62c31 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -1977,6 +1977,10 @@ title']{display:block}", 'default background components should be removed #2': [ 'body{background:transparent none 1px 5px scroll}', 'body{background:1px 5px}' + ], + 'default background components should be removed #3': [ + 'body{background:none repeat scroll 0 0 #000}', + 'body{background:#000}' ] }), 'complex granular properties': cssContext({