gaurav-spacreo / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

CSS - font-family whitespace removal rule #210

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Minify version: 2.1.3 and 2.1.4

PHP version: 5.2.4

What steps will reproduce the problem?

Consider the following css rule:
.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; 
font-size: 1.1em; }

Expected output:
.ui-widget{font-family:Trebuchet 
MS,Tahoma,Verdana,Arial,sans-serif;font-size:1.1em;}

Actual output:
.ui-widget{font-family:TrebuchetMS,Tahoma,Verdana,Arial,sans-serif;font-size:1.1
em;}

The issue:

The Minify removes spaces given between the font name and thus that font 
becomes invalid and browsers shows default font or next font form the font 
family. This is true only for css attribute "font-family". If you replace 
"font-family" with the "font" attribute then the Minify gives the correct 
output. For example,

.ui-widget { font: 1.1em Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; }

Minify converts above css correctly as given below,

.ui-widget{font:1.1em Trebuchet MS,Tahoma,Verdana,Arial,sans-serif;}

Original issue reported on code.google.com by tomnabie...@perfectstormmedia.com on 1 Dec 2010 at 2:56

GoogleCodeExporter commented 9 years ago
Ahh, I thought families with white space MUST be quoted, but it's just "should":
http://www.w3.org/TR/CSS2/fonts.html#propdef-font-family

Since font-families are parsed separately shouldn't be too difficult to fix.

Original comment by mrclay....@gmail.com on 1 Dec 2010 at 3:31

GoogleCodeExporter commented 9 years ago
Fix in R438. Just replace CSS/Compressor.php

Original comment by mrclay....@gmail.com on 20 Dec 2010 at 2:44

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Better fix in r457

Original comment by mrclay....@gmail.com on 23 Jun 2011 at 7:24