Fixes #452 - regression in non-adjacent merging.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Wed, 4 Feb 2015 23:53:20 +0000 (23:53 +0000)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Thu, 5 Feb 2015 00:01:41 +0000 (00:01 +0000)
It's a regression from 2.2 as we added a smarter merging but it
does not always correctly compare arrays (bloody JavaScript ;-).

History.md
lib/selectors/optimizers/advanced.js
test/integration-test.js

index d279e01..04456da 100644 (file)
 * 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)
 ==================
 
index c82826f..555ea81 100644 (file)
@@ -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;
     }
 
index 31ce082..ece205f 100644 (file)
@@ -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({