From: GoalSmashers Date: Sat, 8 Dec 2012 13:45:30 +0000 (+0000) Subject: Added removing quotation in animation and animation-name. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=e4fb761f8d7098e3bee4c3491c6e4ceb6458b0c2;p=clean-css.git Added removing quotation in animation and animation-name. --- diff --git a/lib/clean.js b/lib/clean.js index 97d6b5c6..d4285ae1 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -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'); }); diff --git a/test/unit-test.js b/test/unit-test.js index 17f7a52c..309f432c 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -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({