Fixes #294 - space after rgba/hsla is required in IE<=11.
authorJakub Pawlowicz <jakub@goalsmashers.com>
Sat, 14 Jun 2014 08:25:47 +0000 (09:25 +0100)
committerJakub Pawlowicz <jakub@goalsmashers.com>
Sat, 14 Jun 2014 08:28:12 +0000 (09:28 +0100)
* #165 introduced the bug.

History.md
lib/clean.js
lib/properties/processable.js
test/unit-test.js

index 3634e51..10adbf3 100644 (file)
@@ -2,6 +2,7 @@
 ==================
 
 * Fixes new property optimizer for 'none' values.
+* Fixed issue [#294](https://github.com/GoalSmashers/clean-css/issues/294) - space after rgba/hsla in IE<=11.
 
 [2.2.0 / 2014-06-11](https://github.com/GoalSmashers/clean-css/compare/v2.1.8...2.2.0)
 ==================
index bc4bb39..d4e0028 100644 (file)
@@ -328,9 +328,6 @@ var minify = function(data, callback) {
     return match.replace(/\+/g, ' + ');
   });
 
-  // remove space after (rgba|hsla) declaration - see #165
-  replace(/(rgba|hsla)\(([^\)]+)\) /g, '$1($2)');
-
   // get rid of IE hacks if not in compatibility mode
   if (!options.compatibility)
     replace(/([;\{])[\*_][\w\-]+:[^;\}]+/g, '$1');
index c98b9ea..e1a0a59 100644 (file)
@@ -161,8 +161,11 @@ module.exports = (function () {
           curr = '';
         }
       } else if (c === ' ' && parenthesisLevel === 0) {
-        result.push(curr.trim());
-        curr = '';
+        curr = curr.trim();
+        if (curr !== '') {
+          result.push(curr);
+          curr = '';
+        }
       }
     }
 
index bd8682b..298e4d0 100644 (file)
@@ -182,18 +182,12 @@ vows.describe('clean-units').addBatch({
       'a{text-shadow:rgb(255,0,1) 1px 1px}',
       'a{text-shadow:#ff0001 1px 1px}'
     ],
-    'after rgba': [
-      'a{text-shadow:rgba(255,0,0,1) 0 1px}',
-      'a{text-shadow:rgba(255,0,0,1)0 1px}'
-    ],
+    'after rgba': 'a{text-shadow:rgba(255,0,0,1) 0 1px}',
     'after hsl': [
       'a{text-shadow:hsl(240,100%,40%) -1px 1px}',
       'a{text-shadow:#00c -1px 1px}'
     ],
-    'after hsla': [
-      'a{text-shadow:hsla(240,100%,40%,.5) -1px 1px}',
-      'a{text-shadow:hsla(240,100%,40%,.5)-1px 1px}'
-    ]
+    'after hsla': 'a{text-shadow:hsla(240,100%,40%,.5) -1px 1px}'
   }),
   'line breaks': cssContext({
     'line breaks': [