From: silverwind Date: Sun, 30 Nov 2014 23:22:56 +0000 (+0100) Subject: Fixes #390 - Merging of :fullscreen rules X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=dcc5f10be5915f94693f385bd303a3aa4494c87b;p=clean-css.git Fixes #390 - Merging of :fullscreen rules --- diff --git a/lib/utils/compatibility.js b/lib/utils/compatibility.js index 4ab79e68..17fbfb36 100644 --- a/lib/utils/compatibility.js +++ b/lib/utils/compatibility.js @@ -13,7 +13,7 @@ var DEFAULTS = { }, selectors: { ie7Hack: false, // *+html hack - special: /\-(moz|ms|o|webkit)\-/ // special selectors which prevent merging + special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:fullscreen)/ // special selectors which prevent merging }, units: { rem: true diff --git a/test/integration-test.js b/test/integration-test.js index 3aeee51b..7be2cc08 100644 --- a/test/integration-test.js +++ b/test/integration-test.js @@ -2084,6 +2084,24 @@ title']{display:block}", 'body{background:#000}' ] }), + 'merging of rules': cssContext({ + 'rules without pseudo classes should be merged': [ + 'a{color:red}b{color:red}', + 'a,b{color:red}' + ], + 'rules with standard pseudo classes should be merged': [ + 'a:focus{color:red}b{color:red}', + 'a:focus,b{color:red}' + ], + 'rules with prefixed pseudo classes should not be merged': [ + 'a:-moz-full-screen{color:red}b{color:red}', + 'a:-moz-full-screen{color:red}b{color:red}' + ], + 'rules with standard, but unimplemented pseudo classes should not be merged': [ + 'a:fullscreen{color:red}b{color:red}', + 'a:fullscreen{color:red}b{color:red}' + ] + }), 'complex granular properties': cssContext({ 'two granular properties': 'a{border-bottom:1px solid red;border-color:red}', 'more understandable granular property should override less understandable': [ diff --git a/test/utils/compatibility-test.js b/test/utils/compatibility-test.js index e4533125..d0f73245 100644 --- a/test/utils/compatibility-test.js +++ b/test/utils/compatibility-test.js @@ -14,7 +14,7 @@ vows.describe(Compatibility) assert.isTrue(options.properties.merging); assert.isTrue(options.units.rem); assert.isTrue(options.colors.opacity); - assert.deepEqual(options.selectors.special, /\-(moz|ms|o|webkit)\-/); + assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:fullscreen)/); } }, 'not given': { @@ -33,7 +33,7 @@ vows.describe(Compatibility) assert.isTrue(options.properties.merging); assert.isFalse(options.units.rem); assert.isTrue(options.colors.opacity); - assert.deepEqual(options.selectors.special, /\-(moz|ms|o|webkit)\-/); + assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:fullscreen)/); } } }) @@ -95,7 +95,7 @@ vows.describe(Compatibility) assert.isTrue(options.properties.merging); assert.isTrue(options.units.rem); assert.isTrue(options.colors.opacity); - assert.deepEqual(options.selectors.special, /\-(moz|ms|o|webkit)\-/); + assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:fullscreen)/); } }, 'as a complex string value without group': { @@ -108,7 +108,7 @@ vows.describe(Compatibility) assert.isTrue(options.properties.merging); assert.isFalse(options.units.rem); assert.isTrue(options.colors.opacity); - assert.deepEqual(options.selectors.special, /\-(moz|ms|o|webkit)\-/); + assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:fullscreen)/); } } })