Fixes #332 - background shorthand with none and color at the end (per spec).
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Sat, 2 Aug 2014 10:01:06 +0000 (11:01 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Sat, 2 Aug 2014 10:40:25 +0000 (11:40 +0100)
History.md
lib/properties/processable.js
test/unit-test.js

index c3c79b3..1a9ba6b 100644 (file)
@@ -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)
index 4601660..edb3a00 100644 (file)
@@ -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;
index fc5ba6b..73b62c3 100644 (file)
@@ -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({