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

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.
"
http://www.w3.org/TR/CSS21/fonts.html#font-family-prop

By the way, we have one test on this:

http://test.csswg.org/suites/css2.1/nightly-unstable/html4/font-family-rule-004.htm



> 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.

<http://lists.w3.org/Archives/Public/www-style/2012Apr/0080.html>

{

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

}


1a.

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"


1.b

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

and the same situation as 1a.


1c.

div {font-family: xxx, inherit;}

This appears to me to be INvalid because

'font-family'
    Value:  	[[ <family-name> | <generic-family> ] [, <family-name>|
<generic-family>]* ] | inherit
http://www.w3.org/TR/CSS21/fonts.html#font-family-prop


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


1d.

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


Gérard
-- 
CSS 2.1 Test suite RC6, March 23rd 2011
http://test.csswg.org/suites/css2.1/20110323/html4/toc.html

Contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/

Web authors' contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/web-authors-contributions-css21-testsuite.html

Received on Tuesday, 24 April 2012 01:37:31 UTC