From: GoalSmashers Date: Wed, 18 Dec 2013 20:08:41 +0000 (+0100) Subject: Fixes #191 - quotes around font name should not be removed if value starts with a... X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=2e5c2231c470c7d1525707c2fa8214b206fb8581;p=clean-css.git Fixes #191 - quotes around font name should not be removed if value starts with a digit. --- diff --git a/History.md b/History.md index bfd4060d..2654a624 100644 --- a/History.md +++ b/History.md @@ -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) ================== diff --git a/lib/clean.js b/lib/clean.js index 87225447..12131dd5 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -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 diff --git a/test/unit-test.js b/test/unit-test.js index d872288e..22bcf759 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -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}"