From: Jakub Pawlowicz Date: Mon, 10 Feb 2014 22:18:40 +0000 (+0000) Subject: Adds a full list of unsupported selectors on IE7 and IE8. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=cefbc2ae316a0723fb7206b9a0f4e89ff7dd85ca;p=clean-css.git Adds a full list of unsupported selectors on IE7 and IE8. Makes sure we don't merge all unsupported selectors as per list at: http://kimblim.dk/css-tests/selectors/ --- diff --git a/lib/selectors/optimizer.js b/lib/selectors/optimizer.js index 38950fae..df1c867b 100644 --- a/lib/selectors/optimizer.js +++ b/lib/selectors/optimizer.js @@ -4,8 +4,8 @@ var PropertyOptimizer = require('../properties/optimizer'); module.exports = function Optimizer(data, context, options) { var specialSelectors = { '*': /\-(moz|ms|o|webkit)\-/, - 'ie8': /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:not|:target|:visited|:empty|:first\-of|:last|:nth|:only|:root)/, - 'ie7': /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:not|:target|:visited|:empty|:first\-of|:last|:nth|:only|:root|:after|:before|:focus)/ + 'ie8': /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not)/, + 'ie7': /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:focus|:before|:after|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not)/ }; var minificationsMade = []; diff --git a/test/binary-test.js b/test/binary-test.js index 46635210..a11f4768 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -256,5 +256,15 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({ teardown: function() { this.server.close(); } + }), + 'ie7 compatibility': binaryContext('--compatibility ie7 ./test/data/unsupported/selectors-ie7.css', { + 'should not transform source': function(error, stdout) { + assert.equal(stdout, readFile('./test/data/unsupported/selectors-ie7.css')); + } + }), + 'ie8 compatibility': binaryContext('--compatibility ie8 ./test/data/unsupported/selectors-ie8.css', { + 'should not transform source': function(error, stdout) { + assert.equal(stdout, readFile('./test/data/unsupported/selectors-ie8.css')); + } }) }); diff --git a/test/data/unsupported/selectors-ie7.css b/test/data/unsupported/selectors-ie7.css new file mode 100644 index 00000000..3f2fc3ed --- /dev/null +++ b/test/data/unsupported/selectors-ie7.css @@ -0,0 +1,20 @@ +p:focus{top:0} +p:before{top:0} +p:after{top:0} +p:root{top:0} +p:nth-of-type(1){top:0} +p:nth-last-of-type(1){top:0} +p:first-of-type{top:0} +p:last-of-type{top:0} +p:only-of-type{top:0} +p:only-child{top:0} +p:last-child{top:0} +p:nth-child(1){top:0} +p:nth-last-child(1){top:0} +p:empty{top:0} +p:target{top:0} +p:checked{top:0} +p::selection{top:0} +input:enabled{top:0} +input:disabled{top:0} +p:not(.x){top:0} diff --git a/test/data/unsupported/selectors-ie8.css b/test/data/unsupported/selectors-ie8.css new file mode 100644 index 00000000..2d01251e --- /dev/null +++ b/test/data/unsupported/selectors-ie8.css @@ -0,0 +1,17 @@ +p:root{top:0} +p:nth-of-type(1){top:0} +p:nth-last-of-type(1){top:0} +p:first-of-type{top:0} +p:last-of-type{top:0} +p:only-of-type{top:0} +p:only-child{top:0} +p:last-child{top:0} +p:nth-child(1){top:0} +p:nth-last-child(1){top:0} +p:empty{top:0} +p:target{top:0} +p:checked{top:0} +p::selection{top:0} +input:enabled{top:0} +input:disabled{top:0} +p:not(.x){top:0}