Fixes #567 - regression in function color merging.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Fri, 8 May 2015 08:46:48 +0000 (09:46 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Fri, 8 May 2015 08:55:29 +0000 (09:55 +0100)
Having two colors are functions resulted in a incorect call to a function
checking if two colors are same function or not.

History.md
lib/properties/can-override.js
test/properties/override-compacting-test.js

index 43891cb..3d56d10 100644 (file)
 * Fixed issue [#517](https://github.com/jakubpawlowicz/clean-css/issues/517) - turning off color optimizations.
 * Fixed issue [#542](https://github.com/jakubpawlowicz/clean-css/issues/542) - space after closing brace in IE.
 
+[3.2.9 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.2.8...3.2)
+==================
+
+* Fixed issue [#567](https://github.com/jakubpawlowicz/clean-css/issues/567) - merging colors as functions.
+
 [3.2.8 / 2015-05-04](https://github.com/jakubpawlowicz/clean-css/compare/v3.2.7...v3.2.8)
 ==================
 
index 5d0555a..88857d7 100644 (file)
@@ -53,7 +53,7 @@ function color(property1, property2, validator) {
     return false;
 
   // Functions with the same name can override each other; same values can override each other
-  return sameFunctionOrValue(property1, property2);
+  return sameFunctionOrValue(property1, property2, validator);
 }
 
 function twoOptionalFunctions(property1, property2, validator) {
index b90bea8..7159db2 100644 (file)
@@ -31,6 +31,15 @@ function _optimize(source, compatibility, aggressiveMerging) {
 
 vows.describe(optimize)
   .addBatch({
+    'longhand then longhand - background colors as functions': {
+      'topic': 'p{background-color:-ms-linear-gradient(top,red,#000);background-color:linear-gradient(top,red,#000)}',
+      'into': function (topic) {
+        assert.deepEqual(_optimize(topic), [
+          [['background-color', false , false], ['-ms-linear-gradient(top,red,#000)']],
+          [['background-color', false , false], ['linear-gradient(top,red,#000)']]
+        ]);
+      }
+    },
     'longhand then shorthand': {
       'topic': 'p{background-image:none;background:__ESCAPED_URL_CLEAN_CSS0__}',
       'into': function (topic) {