- From: Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>
- Date: Wed, 25 Apr 2012 01:04:50 +0800
- To: Gérard Talbot <www-style@gtalbot.org>
- CC: John Daggett <jdaggett@mozilla.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, WWW Style <www-style@w3.org>
(12/04/25 0:23), "Gérard Talbot" wrote:
> 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:
>
>>>>> 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:
Well, I said "inside <family-name>", so if the "Value:" field is
"<family-name> | inherit", even if 'inherit' doesn't match <family-name>
because of proposed wording, it still matches the right hand side.
Having said that, since you found this confusing, what about
| unquoted global keywords ('inherit', 'initial' and 'default') are
| not allowed when parsed as <family-name>.
?
>> 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 */
Well, this is still questionable before we make a decision and this is
the subject of this thread.
> 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
For what it's worth, 'font-family: inherit xx;' (but not 'font-family:
xx inherit;') is treated invalid by the validator and this is different
from all other browsers. I am reluctant to make yet another summary
table but we have four behaviors: 1)IE 2) Opera=your reading of the
current spec 3) WebKit=Firefox 4)W3C CSS Validator.
> 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
Well, if a keyword 'inherit' can be parsed as <family-name> (the spec
currently doesn't say it can't), 'foo, inherit' can be parsed as
"<family-name> , <family-name>" and this is matching the left hand side
of the grammar.
The problem is that a single keyword 'inherit' can match both the left
hand side (parsed as a single <family-name>) and the right hand side. My
proposed wording aims at resolving this ambiguity.
Cheers,
Kenny
Received on Tuesday, 24 April 2012 17:05:25 UTC