Added removing quotation in animation and animation-name.
authorGoalSmashers <jakub@goalsmashers.com>
Sat, 8 Dec 2012 13:45:30 +0000 (13:45 +0000)
committerGoalSmashers <jakub@goalsmashers.com>
Sat, 8 Dec 2012 13:45:30 +0000 (13:45 +0000)
lib/clean.js
test/unit-test.js

index 97d6b5c..d4285ae 100644 (file)
@@ -118,8 +118,8 @@ var CleanCSS = {
     // trailing semicolons
     replace(/;\}/g, '}');
 
-    // strip parentheses in font names
-    replace(/(font|font\-family):([^;}]+)/g, function(match, propertyName, fontDef) {
+    // strip quotation in animations & font names
+    replace(/(animation|animation\-name|font|font\-family):([^;}]+)/g, function(match, propertyName, fontDef) {
       return propertyName + ':' + fontDef.replace(/['"]([\w\-]+)['"]/g, '$1');
     });
 
index 17f7a52..309f432 100644 (file)
@@ -510,6 +510,24 @@ vows.describe('clean-units').addBatch({
     'remove name quotes for vendor prefixes': [
       "@-moz-keyframes 'test'{}@-o-keyframes 'test'{}@-webkit-keyframes 'test'{}",
       "@-moz-keyframes test{}@-o-keyframes test{}@-webkit-keyframes test{}"
+    ],
+    'remove quotes in animation': [
+      "div{animation:'test' 2s ease-in .5s 3}",
+      "div{animation:test 2s ease-in .5s 3}"
+    ],
+    'not remove quotes in animation when name with space inside': "div{animation:'test 1' 2s ease-in .5s 3}",
+    'remove quotes in vendor prefixed animation name': [
+      "div{-moz-animation:'test' 2s ease-in;-o-animation:'test' 2s ease-in;-webkit-animation:'test' 2s ease-in}",
+      "div{-moz-animation:test 2s ease-in;-o-animation:test 2s ease-in;-webkit-animation:test 2s ease-in}"
+    ],
+    'remove quotes in animation-name': [
+      "div{animation-name:'test'}",
+      "div{animation-name:test}"
+    ],
+    'not remove quotes in animation when name with space inside': "div{animation-name:'test 1'}",
+    'remove quotes in vendor prefixed animation name': [
+      "div{-moz-animation-name:'test';-o-animation-name:'test';-webkit-animation-name:'test'}",
+      "div{-moz-animation-name:test;-o-animation-name:test;-webkit-animation-name:test}"
     ]
   }),
   'ie filters': cssContext({