W3C home > Mailing lists > Public > www-style@w3.org > April 2012

Re: [css21] 'font-family' should disallow 'inherit' in font names more strictly

From: Gérard Talbot <www-style@gtalbot.org>
Date: Mon, 23 Apr 2012 21:36:58 -0400
Message-ID: <43b791e08ea618ac1ad38ce7e737feb8.squirrel@ed-sh-cp3.entirelydigital.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: "www-style list" <www-style@w3.org>

Le Lun 23 avril 2012 17:55, Tab Atkins Jr. a écrit :
> Right now, 2.1 says the following about using 'inherit' in a font name:
> # The keywords 'initial' and 'default' are reserved for
> # future use and must also be quoted when used as
> # font names.

Huh,... it seems to me that you misquoted this. It is written:

Font family names that happen to be the same as a keyword value
('inherit', 'serif', 'sans-serif', 'monospace', 'fantasy', and 'cursive')
must be quoted to prevent confusion with the keywords with the same names.

By the way, we have one test on this:


> This isn't strict enough, and implementations do somewhat different
> things around this.  See Kenny's email at
> <http://lists.w3.org/Archives/Public/www-style/2012Apr/0080.html>
> where he shows several differences in implementations, where some UAs
> accept 'inherit' as part of a font-name, or even as an entire
> font-name in some circumstances.



1a. 'font-family: xxx inherit;' is valid in all browsers
1b. 'font-family: inherit xx;' is valid in IE9 and Opera12alpha but not
1c. 'font-family: xxx, inherit;' is valid in all browsers except
1d. 'font-family: inherit, xxx;' is valid in IE9



div {font-family: xxx inherit;} /* is valid */

It's a case of an unquoted font name with one blank white space. So, the
parser should be trying to fetch an installed font with the lovely name of
"xxx inherit"


div {font-family: inherit xx;} /* is valid */

and the same situation as 1a.


div {font-family: xxx, inherit;}

This appears to me to be INvalid because

    Value:  	[[ <family-name> | <generic-family> ] [, <family-name>|
<generic-family>]* ] | inherit

div {font-family: xxx, "inherit";} /* is valid because inherit is quoted */


div {font-family: inherit, xxx;} /* is INvalid */

because inherit is not quoted. Here too

div {font-family: "inherit", xxx;} /* is valid because inherit is quoted */

We can create more tests on all this.

> We propose tightening this up, since there's no use-case for using
> unquoted 'inherit' in a font name, to:
>> The keywords 'initial' and 'default' are reserved for
>> future use and must also be quoted when used _in_
>> font names.
> ~TJ and fantasai

CSS 2.1 Test suite RC6, March 23rd 2011

Contributions to CSS 2.1 test suite

Web authors' contributions to CSS 2.1 test suite
Received on Tuesday, 24 April 2012 01:37:31 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:57 UTC