From: Jakub Pawlowicz Date: Mon, 28 Jul 2014 21:38:00 +0000 (+0100) Subject: Fixes #326 - regression issue in background-size minification. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=0bf6c3421091bd9f4131cfb96b425da15ceaf694;p=clean-css.git Fixes #326 - regression issue in background-size minification. --- diff --git a/History.md b/History.md index c5957246..54b29c29 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[2.2.11 / 2014-xx-xx](https://github.com/GoalSmashers/clean-css/compare/v2.2.10...v2.2.11) +================== + +* Fixed issue [#326](https://github.com/GoalSmashers/clean-css/issues/326) - background-size regression. + [2.2.10 / 2014-07-27](https://github.com/GoalSmashers/clean-css/compare/v2.2.9...v2.2.10) ================== diff --git a/lib/properties/processable.js b/lib/properties/processable.js index 9d3e0aea..46016606 100644 --- a/lib/properties/processable.js +++ b/lib/properties/processable.js @@ -444,6 +444,11 @@ module.exports = (function () { if (meta && meta.partsCount && meta.position < meta.partsCount - 1 && processable[token.prop].multiValueLastOnly) continue; + var requiresPreceeding = processable[token.prop].shorthandFollows; + if (requiresPreceeding && (tokens[i - 1].value == processable[requiresPreceeding].defaultValue)) { + result.value += ' ' + tokens[i - 1].value; + } + result.value += (processable[token.prop].prefixShorthandValueWith || ' ') + token.value; } @@ -646,7 +651,8 @@ module.exports = (function () { canOverride: canOverride.always, defaultValue: 'auto', shortestValue: '0 0', - prefixShorthandValueWith: '/' + prefixShorthandValueWith: '/', + shorthandFollows: 'background-position' }, 'background-attachment': { canOverride: canOverride.always, diff --git a/test/unit-test.js b/test/unit-test.js index bad994bf..c8dd5948 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -2017,6 +2017,10 @@ title']{display:block}", 'with background-position shorthands and spaces': [ 'a{background:url(top.jpg) 0 / cover no-repeat}', 'a{background:url(top.jpg) 0/cover no-repeat}' + ], + 'with background-size property': [ + 'a{background:none;background-image:url(1.png);background-size:28px 28px}', + 'a{background:url(1.png) 0 0/28px 28px}' ] }), 'misc advanced': cssContext({