Last Comment Bug 471300 - unquoted font-family names or fragments starting with digits break parsing
: unquoted font-family names or fragments starting with digits break parsing
Product: Firefox
Classification: Client Software
Component: General (show other bugs)
: unspecified
: x86 Mac OS X
-- normal with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
Depends on:
  Show dependency treegraph
Reported: 2008-12-27 17:41 PST by Michael Zajac
Modified: 2008-12-27 19:38 PST (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Michael Zajac 2008-12-27 17:41:28 PST
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-ca) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv: Gecko/2008102920 Firefox/3.0.4

A font name starting with a digit, like “1font”, will cause the entire font-family declaration to be discarded with the error “Error in parsing value for property 'font-family'. Declaration dropped”.  A font name with a digit after a space, like “MPH 2B Damase” also prepends “Expected end of value for property but found '2B'.”  

In either case, quoting the font-family works around the problem.

Reproducible: Always

Steps to Reproduce:
1. create a XHTML 1.0 web page which includes the CSS declarations “.foo { font-family: 1font, monospace; } .bar { font-family: MPH 2B Damase, serif; }”
2. load the page in Firefox

Actual Results:  
1. check the error console: 2 messages are generated
2. check the page rendering, the fallback fonts are not applied to the elements either

Expected Results:  
The fake font name “1font” should be ignored and the fallback “monospace” applied.  The real font “MPH 2B Damase” should be applied if present, otherwise the fallback “serif”.

See bug Bug 292271, which may be an example of the same problem.
Comment 1 User image philippe (part-time) 2008-12-27 19:38:53 PST
Well, yes, you _should_ quote those font-family names.

.foo {font-family: 1font, monospace; }
the css parser see a number followed by an identifier and treats it as a unit (similar to, say, 1px) (unknown DIMENSION),
that is an invalid value for the 'font-family' property. The whole declaration should be ignored

The same reasoning applies to your .bar rule.

see also

Opera and WebKit (Safari) behave the same as Gecko.

Note You need to log in before you can comment on or make changes to this bug.