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

Le Mar 24 avril 2012 5:30, Kang-Hao (Kenny) Lu a écrit :
> (12/04/24 14:02), John Daggett wrote:
>> Tab Atkins Jr. wrote:
>>

[snipped]

>>>> The keywords 'initial' and 'default' are reserved for
>>>> future use and must also be quoted when used _in_
>>>> font names.
>>
>> This is equally imprecise, it implies that only the keywords are
>> quoted when what you mean to say is that font family names
>> *containing* these keywords must be quoted.
>
> Either that or
>
>   | unquoted global keywords ('inherit', 'initial' and 'default') are
>   | not allowed inside <family-name>.


div {font-family: inherit;}

is allowed, is valid, is permitted and is tested:

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



> I mentioned that I don't like this direction so my propose wording is
>
>   | If the value of 'font-family' is a single global keyword
>   | ('inherit', 'initial' and 'default'), UAs must not interpret it as
>   | <family-name> but the meaning of the global keyword.


... unless it is quoted:

"
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


> The implication is that 'font-family: foo, inherit' is still valid. This
> follows IE9.


div#a {font-family: foo, inherit;} /*  is invalid */

div#b {font-family: inherit, bar;} /* is invalid */

The CSS validator also reports these as errors:

1 	div#a 	Value Error : font-family Too many values or values are not
recognized : foo,inherit
3 	div#b 	Value Error : font-family Too many values or values are not
recognized : inherit,bar


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

"
A bar (|) separates two or more alternatives: exactly one of them must occur.
(...)
Brackets ([ ]) are for grouping.
(...)
An asterisk (*) indicates that the preceding type, word, or group occurs
zero or more times.
"
http://www.w3.org/TR/CSS21/about.html#value-defs

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 16:24:21 UTC