Fixes #453 - x & y `background-repeat`.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Sat, 7 Feb 2015 11:44:31 +0000 (11:44 +0000)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Sat, 7 Feb 2015 12:36:30 +0000 (12:36 +0000)
Apparently we were not handling double `background-repeat` previously.

History.md
lib/properties/processable.js
test/integration-test.js

index 3c28050..abbd3e2 100644 (file)
 * Fixed issue [#445](https://github.com/GoalSmashers/clean-css/issues/445) - regression issue in url processor.
 * Fixed issue [#449](https://github.com/GoalSmashers/clean-css/issues/449) - warns of missing close braces.
 
+[3.0.10 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.9...v3.0.10)
+==================
+
+* Fixed issue [#453](https://github.com/jakubpawlowicz/clean-css/issues/453) - double `background-repeat`.
+
 [3.0.9 / 2015-02-04](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.8...v3.0.9)
 ==================
 
index 5122f49..f27e791 100644 (file)
@@ -177,6 +177,7 @@ module.exports = (function () {
     var positionSet = false;
     var clipSet = false;
     var originSet = false;
+    var repeatSet = false;
 
     // Take care of inherit
     if (token.value === 'inherit') {
@@ -205,7 +206,12 @@ module.exports = (function () {
           clipSet = true;
         }
       } else if (validator.isValidBackgroundRepeat(currentPart)) {
-        repeat.value = currentPart;
+        if (repeatSet) {
+          repeat.value = currentPart + ' ' + repeat.value;
+        } else {
+          repeat.value = currentPart;
+          repeatSet = true;
+        }
       } else if (validator.isValidBackgroundPositionPart(currentPart) || validator.isValidBackgroundSizePart(currentPart)) {
         if (i > 0) {
           var previousPart = parts[i - 1];
index ece205f..17f851f 100644 (file)
@@ -2020,6 +2020,10 @@ title']{display:block}",
       'a{background:url(a.jpg) !important; background-color:#fff !important; background-size:10px 10px !important}',
       'a{background:url(a.jpg)#fff!important;background-size:10px 10px!important}'
     ],
+    'shorthand background-repeat correctly': [
+      'a{background:url(/image/path.png) no-repeat repeat}',
+      'a{background:url(/image/path.png)no-repeat repeat}'
+    ],
     'shorthand border-width': [
       '.t{border-top-width:7px;border-bottom-width:7px;border-left-width:4px;border-right-width:4px}',
       '.t{border-width:7px 4px}'