Fixes #191 - quotes around font name should not be removed if value starts with a...
authorGoalSmashers <jakub@goalsmashers.com>
Wed, 18 Dec 2013 20:08:41 +0000 (21:08 +0100)
committerGoalSmashers <jakub@goalsmashers.com>
Wed, 18 Dec 2013 22:15:50 +0000 (23:15 +0100)
History.md
lib/clean.js
test/unit-test.js

index bfd4060..2654a62 100644 (file)
@@ -9,6 +9,11 @@
 * Fixed issue [#165](https://github.com/GoalSmashers/clean-css/issues/165) - extra space after trailing parenthesis.
 * Fixed issue [#186](https://github.com/GoalSmashers/clean-css/issues/186) - strip unit from 0rem.
 
+[2.0.3 / 2013-xx-xx (UNRELEASED)](https://github.com/GoalSmashers/clean-css/compare/v2.0.2...v2.0.3)
+==================
+
+* Fixed issue [#191](https://github.com/GoalSmashers/clean-css/issues/191) - leading numbers in font/animation names.
+
 [2.0.2 / 2013-11-18](https://github.com/GoalSmashers/clean-css/compare/v2.0.1...v2.0.2)
 ==================
 
index 8722544..12131dd 100644 (file)
@@ -123,8 +123,8 @@ CleanCSS.prototype.minify = function(data) {
   });
 
   // strip parentheses in animation & font names
-  replace(/(animation|animation\-name|font|font\-family):([^;}]+)/g, function(match, propertyName, fontDef) {
-    return propertyName + ':' + fontDef.replace(/['"]([\w\-]+)['"]/g, '$1');
+  replace(/(animation|animation\-name|font|font\-family):([^;}]+)/g, function(match, propertyName, def) {
+    return propertyName + ':' + def.replace(/['"]([a-zA-Z][a-zA-Z\d\-_]+)['"]/g, '$1');
   });
 
   // strip parentheses in @keyframes
index d872288..22bcf75 100644 (file)
@@ -795,6 +795,8 @@ path")}',
       "a{font-family:Helvetica,Arial}"
     ],
     'do not remove font family double quotation if space inside': 'a{font-family:"Courier New"}',
+    'do not remove font quotation if starts with a number': 'a{font:\'123font\'}',
+    'do not remove font family quotation if starts with a number': 'a{font-family:\'123font\'}',
     'remove font quotation': [
       "a{font:12px/16px \"Helvetica\",'Arial'}",
       "a{font:12px/16px Helvetica,Arial}"