From: Jakub Pawlowicz Date: Wed, 4 Feb 2015 23:53:20 +0000 (+0000) Subject: Fixes #452 - regression in non-adjacent merging. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=612219e575fc98eae990deacbeb6566c471e0a44;p=clean-css.git Fixes #452 - regression in non-adjacent merging. It's a regression from 2.2 as we added a smarter merging but it does not always correctly compare arrays (bloody JavaScript ;-). --- diff --git a/History.md b/History.md index d279e015..04456da8 100644 --- a/History.md +++ b/History.md @@ -15,6 +15,11 @@ * Fixed issue [#445](https://github.com/GoalSmashers/clean-css/issues/445) - regression issue in url processor. * Fixed issue [#449](https://github.com/GoalSmashers/clean-css/issues/449) - warns of missing close braces. +[3.0.9 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.8...v3.0.9) +================== + +* Fixed issue [#452](https://github.com/jakubpawlowicz/clean-css/issues/452) - regression in advanced merging. + [3.0.8 / 2015-01-31](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.7...v3.0.8) ================== diff --git a/lib/selectors/optimizers/advanced.js b/lib/selectors/optimizers/advanced.js index c82826f3..555ea812 100644 --- a/lib/selectors/optimizers/advanced.js +++ b/lib/selectors/optimizers/advanced.js @@ -222,7 +222,7 @@ AdvancedOptimizer.prototype.reduceComplexNonAdjacentCases = function (tokens, ca callback: collectReducedBodies }); - if (reducedBodies[reducedBodies.length - 1].list.length != reducedBodies[0].list.length) + if (reducedBodies[reducedBodies.length - 1].list.join(';') != reducedBodies[0].list.join(';')) continue allSelectors; } diff --git a/test/integration-test.js b/test/integration-test.js index 31ce082f..ece205ff 100644 --- a/test/integration-test.js +++ b/test/integration-test.js @@ -1797,6 +1797,10 @@ title']{display:block}", 'with three intermediate, non-overriding selectors': [ '.one{color:red;margin:0}.two{color:#fff}.one{font-size:12px}.three{color:#000}.one{padding:0}', '.one{color:red;margin:0;font-size:12px;padding:0}.two{color:#fff}.three{color:#000}' + ], + 'successive selectors': [ + 'footer,header{top:1.25em;bottom:1.25em}header{top:2.5em}footer{bottom:2.5em}', + 'footer,header{top:1.25em;bottom:1.25em}header{top:2.5em}footer{bottom:2.5em}' ] }), 'rerun optimizers': cssContext({