From 87baf864cc3cca5258b764fba25057011a43afa6 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 18 Dec 2014 00:35:38 +0000 Subject: [PATCH] Fixes #405 - background-size merging is off by default. * That's to remedy issues in Chrome and older versions of Safari and stock Android browsers. * If not for Chrome's issue then it would have been left on by default. --- History.md | 1 + lib/utils/compatibility.js | 2 +- test/fixtures/issue-312-min.css | 2 +- test/integration-test.js | 12 +++++++----- test/utils/compatibility-test.js | 8 ++++---- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/History.md b/History.md index 319f0e93..0998e3f2 100644 --- a/History.md +++ b/History.md @@ -27,6 +27,7 @@ * Fixed issue [#400](https://github.com/GoalSmashers/clean-css/issues/400) - API to accept an array of filenames. * Fixed issue [#403](https://github.com/GoalSmashers/clean-css/issues/403) - tracking input files in source maps. * Fixed issue [#404](https://github.com/GoalSmashers/clean-css/issues/404) - no state sharing in API. +* Fixed issue [#405](https://github.com/GoalSmashers/clean-css/issues/405) - disables default background-size merging. * Refixed issue [#304](https://github.com/GoalSmashers/clean-css/issues/304) - background position merging. [2.2.19 / 2014-11-20](https://github.com/jakubpawlowicz/clean-css/compare/v2.2.18...v2.2.19) diff --git a/lib/utils/compatibility.js b/lib/utils/compatibility.js index 9f4cc6c7..eaad4fa5 100644 --- a/lib/utils/compatibility.js +++ b/lib/utils/compatibility.js @@ -6,7 +6,7 @@ var DEFAULTS = { opacity: true // rgba / hsla }, properties: { - backgroundSizeMerging: true, // background-size to shorthand + backgroundSizeMerging: false, // background-size to shorthand iePrefixHack: false, // underscore / asterisk prefix hacks on IE ieSuffixHack: false, // \9 suffix hacks on IE merging: true // merging properties into one diff --git a/test/fixtures/issue-312-min.css b/test/fixtures/issue-312-min.css index cf91df93..84699e19 100644 --- a/test/fixtures/issue-312-min.css +++ b/test/fixtures/issue-312-min.css @@ -1 +1 @@ -.envelope{background:url(one.png) top center/35px 4px repeat-x,url(one.png) bottom center/35px 4px repeat-x,url(two.png) 110% 10px/101px 61px no-repeat #eee} +.envelope{background:url(one.png) top center repeat-x,url(one.png) bottom center repeat-x,url(two.png) 110% 10px no-repeat #eee;background-size:35px 4px,35px 4px,101px 61px} \ No newline at end of file diff --git a/test/integration-test.js b/test/integration-test.js index 7f6fff70..d7fcbae8 100644 --- a/test/integration-test.js +++ b/test/integration-test.js @@ -2195,13 +2195,15 @@ title']{display:block}", ], '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}' + 'a{background:url(1.png);background-size:28px 28px}' ] }), - 'background size with -properties.backgroundSizeMerging': cssContext({ - 'standard': 'div{background:url(image.png) center no-repeat;background-size:cover}', - 'prefix': 'div{-webkit-background:url(image.png) center no-repeat;-webkit-background-size:cover}' - }, { compatibility: '-properties.backgroundSizeMerging' }), + 'background size with +properties.backgroundSizeMerging': cssContext({ + '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}' + ] + }, { compatibility: '+properties.backgroundSizeMerging' }), 'multiple backgrounds': cssContext({ 'should not produce longer values': 'p{background:no-repeat;background-position:100% 0,0 100%,100% 100%,50% 50%}' }), diff --git a/test/utils/compatibility-test.js b/test/utils/compatibility-test.js index c74c370f..48cd5cc9 100644 --- a/test/utils/compatibility-test.js +++ b/test/utils/compatibility-test.js @@ -10,7 +10,7 @@ vows.describe(Compatibility) assert.isFalse(options.properties.iePrefixHack); assert.isFalse(options.properties.ieSuffixHack); assert.isFalse(options.selectors.ie7Hack); - assert.isTrue(options.properties.backgroundSizeMerging); + assert.isFalse(options.properties.backgroundSizeMerging); assert.isTrue(options.properties.merging); assert.isTrue(options.units.rem); assert.isTrue(options.colors.opacity); @@ -29,7 +29,7 @@ vows.describe(Compatibility) assert.isFalse(options.properties.iePrefixHack); assert.isFalse(options.properties.ieSuffixHack); assert.isFalse(options.selectors.ie7Hack); - assert.isTrue(options.properties.backgroundSizeMerging); + assert.isFalse(options.properties.backgroundSizeMerging); assert.isTrue(options.properties.merging); assert.isFalse(options.units.rem); assert.isTrue(options.colors.opacity); @@ -91,7 +91,7 @@ vows.describe(Compatibility) assert.isTrue(options.properties.iePrefixHack); assert.isFalse(options.properties.ieSuffixHack); assert.isFalse(options.selectors.ie7Hack); - assert.isTrue(options.properties.backgroundSizeMerging); + assert.isFalse(options.properties.backgroundSizeMerging); assert.isTrue(options.properties.merging); assert.isTrue(options.units.rem); assert.isTrue(options.colors.opacity); @@ -104,7 +104,7 @@ vows.describe(Compatibility) assert.isTrue(options.properties.iePrefixHack); assert.isFalse(options.properties.ieSuffixHack); assert.isFalse(options.selectors.ie7Hack); - assert.isTrue(options.properties.backgroundSizeMerging); + assert.isFalse(options.properties.backgroundSizeMerging); assert.isTrue(options.properties.merging); assert.isFalse(options.units.rem); assert.isTrue(options.colors.opacity); -- 2.34.1