From: Jakub Pawlowicz Date: Thu, 6 Aug 2015 08:14:30 +0000 (+0100) Subject: Fixes #634 - merging :placeholder selectors. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=7ed314ddf2ecc92279aa0cf227f3f760b3999e99;p=clean-css.git Fixes #634 - merging :placeholder selectors. :placeholder is also not widely supported (IE10+) so we need to skip merging it. --- diff --git a/History.md b/History.md index c053ea64..4faf228f 100644 --- a/History.md +++ b/History.md @@ -10,6 +10,7 @@ * Fixed issue [#629](https://github.com/jakubpawlowicz/clean-css/issues/629) - source maps & background shorthands. * Fixed issue [#630](https://github.com/jakubpawlowicz/clean-css/issues/630) - vendor prefixed flex optimizations. * Fixed issue [#633](https://github.com/jakubpawlowicz/clean-css/issues/633) - handling data URI with brackets. +* Fixed issue [#634](https://github.com/jakubpawlowicz/clean-css/issues/634) - merging :placeholder selectors. [3.3.7 / 2015-07-29](https://github.com/jakubpawlowicz/clean-css/compare/v3.3.6...v3.3.7) ================== diff --git a/lib/utils/compatibility.js b/lib/utils/compatibility.js index 2594d013..66892a96 100644 --- a/lib/utils/compatibility.js +++ b/lib/utils/compatibility.js @@ -20,7 +20,7 @@ var DEFAULTS = { selectors: { adjacentSpace: false, // div+ nav Android stock browser hack ie7Hack: false, // *+html hack - special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:dir\([a-z-]*\)|:first(?![a-z-])|:fullscreen|:left|:read-only|:read-write|:right)/ // special selectors which prevent merging + special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:dir\([a-z-]*\)|:first(?![a-z-])|:fullscreen|:left|:read-only|:read-write|:right|:placeholder)/ // special selectors which prevent merging }, units: { ch: true, @@ -51,7 +51,7 @@ var DEFAULTS = { selectors: { adjacentSpace: false, ie7Hack: false, - special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not)/ + special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not|:placeholder)/ }, units: { ch: false, @@ -82,7 +82,7 @@ var DEFAULTS = { selectors: { adjacentSpace: false, ie7Hack: true, - special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:focus|:before|:after|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not)/ + special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:focus|:before|:after|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not|:placeholder)/ }, units: { ch: false, diff --git a/test/integration-test.js b/test/integration-test.js index 59a3b27f..4585524e 100644 --- a/test/integration-test.js +++ b/test/integration-test.js @@ -2343,6 +2343,10 @@ vows.describe('integration tests') 'rules with not-so-well-supported pseudo classes should not be merged #4': [ 'a:first{color:red}b{color:red}', 'a:first{color:red}b{color:red}' + ], + 'rules with not-so-well-supported pseudo classes should not be merged #5': [ + ':placeholder{color:red}b{color:red}', + ':placeholder{color:red}b{color:red}' ] }) ) diff --git a/test/utils/compatibility-test.js b/test/utils/compatibility-test.js index 1a92662a..2b98d598 100644 --- a/test/utils/compatibility-test.js +++ b/test/utils/compatibility-test.js @@ -22,7 +22,6 @@ vows.describe(Compatibility) assert.isTrue(options.properties.zeroUnits); assert.isFalse(options.selectors.adjacentSpace); assert.isFalse(options.selectors.ie7Hack); - assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:dir\([a-z-]*\)|:first(?![a-z-])|:fullscreen|:left|:read-only|:read-write|:right)/); assert.isTrue(options.units.ch); assert.isTrue(options.units.rem); assert.isTrue(options.units.vh); @@ -57,7 +56,6 @@ vows.describe(Compatibility) assert.isTrue(options.properties.zeroUnits); assert.isFalse(options.selectors.adjacentSpace); assert.isFalse(options.selectors.ie7Hack); - assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:dir\([a-z-]*\)|:first(?![a-z-])|:fullscreen|:left|:read-only|:read-write|:right)/); assert.isTrue(options.units.ch); assert.isFalse(options.units.rem); assert.isTrue(options.units.vh); @@ -87,7 +85,6 @@ vows.describe(Compatibility) assert.isTrue(options.properties.zeroUnits); assert.isFalse(options.selectors.adjacentSpace); assert.isFalse(options.selectors.ie7Hack); - assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not)/); assert.isFalse(options.units.ch); assert.isFalse(options.units.rem); assert.isFalse(options.units.vh); @@ -115,7 +112,6 @@ vows.describe(Compatibility) assert.isTrue(options.properties.zeroUnits); assert.isFalse(options.selectors.adjacentSpace); assert.isTrue(options.selectors.ie7Hack); - assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:focus|:before|:after|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not)/); assert.isFalse(options.units.ch); assert.isFalse(options.units.rem); assert.isFalse(options.units.vh); @@ -153,7 +149,6 @@ vows.describe(Compatibility) assert.isTrue(options.properties.zeroUnits); assert.isFalse(options.selectors.adjacentSpace); assert.isFalse(options.selectors.ie7Hack); - assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not)/); assert.isFalse(options.units.ch); assert.isFalse(options.units.rem); assert.isFalse(options.units.vh); @@ -181,7 +176,6 @@ vows.describe(Compatibility) assert.isTrue(options.properties.zeroUnits); assert.isFalse(options.selectors.adjacentSpace); assert.isFalse(options.selectors.ie7Hack); - assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:dir\([a-z-]*\)|:first(?![a-z-])|:fullscreen|:left|:read-only|:read-write|:right)/); assert.isTrue(options.units.ch); assert.isTrue(options.units.rem); assert.isTrue(options.units.vh); @@ -209,7 +203,6 @@ vows.describe(Compatibility) assert.isTrue(options.properties.zeroUnits); assert.isFalse(options.selectors.adjacentSpace); assert.isFalse(options.selectors.ie7Hack); - assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:dir\([a-z-]*\)|:first(?![a-z-])|:fullscreen|:left|:read-only|:read-write|:right)/); assert.isTrue(options.units.ch); assert.isFalse(options.units.rem); assert.isTrue(options.units.vh);