From: Jakub Pawlowicz Date: Sat, 7 Feb 2015 11:44:31 +0000 (+0000) Subject: Fixes #453 - x & y `background-repeat`. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=0603a7eda215e29579a08667fbb2a47cbc859bb4;p=clean-css.git Fixes #453 - x & y `background-repeat`. Apparently we were not handling double `background-repeat` previously. --- diff --git a/History.md b/History.md index 3c28050c..abbd3e27 100644 --- a/History.md +++ b/History.md @@ -15,6 +15,11 @@ * 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) ================== diff --git a/lib/properties/processable.js b/lib/properties/processable.js index 5122f494..f27e7916 100644 --- a/lib/properties/processable.js +++ b/lib/properties/processable.js @@ -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]; diff --git a/test/integration-test.js b/test/integration-test.js index ece205ff..17f851f5 100644 --- a/test/integration-test.js +++ b/test/integration-test.js @@ -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}'