Fixes #544 - regression in same value merging.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Thu, 23 Apr 2015 20:41:25 +0000 (21:41 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Fri, 24 Apr 2015 09:23:10 +0000 (10:23 +0100)
History.md
lib/properties/optimizer.js
test/fixtures/issue-544-min.css [new file with mode: 0644]
test/fixtures/issue-544.css [new file with mode: 0644]

index f584bc0..2742310 100644 (file)
@@ -9,6 +9,11 @@
 * Moves URL rebasing & rewriting into lib/urls.
 * Fixed issue [#436](https://github.com/jakubpawlowicz/clean-css/issues/436) - refactors URI rewriting.
 
+[3.2.4 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.2.3...3.2)
+==================
+
+* Fixed issue [#544](https://github.com/jakubpawlowicz/clean-css/issues/544) - regression in same value merging.
+
 [3.2.3 / 2015-04-22](https://github.com/jakubpawlowicz/clean-css/compare/v3.2.2...v3.2.3)
 ==================
 
index 55cb387..d632214 100644 (file)
@@ -113,7 +113,7 @@ function _optimize(properties, mergeAdjacent, aggressiveMerging, validator) {
     if (property.unused)
       continue;
 
-    if (_name == lastName && sameValue(position)) {
+    if (position > 0 && _name == lastName && sameValue(position)) {
       property.unused = true;
       continue;
     }
diff --git a/test/fixtures/issue-544-min.css b/test/fixtures/issue-544-min.css
new file mode 100644 (file)
index 0000000..a5cdd95
--- /dev/null
@@ -0,0 +1 @@
+.btn-danger{background-image:-webkit-gradient(linear,left 0,left 100%,from(#d9534f),to(#c9302c));background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%)}
\ No newline at end of file
diff --git a/test/fixtures/issue-544.css b/test/fixtures/issue-544.css
new file mode 100644 (file)
index 0000000..96372f0
--- /dev/null
@@ -0,0 +1,8 @@
+.btn-danger {
+  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c));
+  background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
+}
+
+.btn-danger {
+  background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
+}