- From: Gérard Talbot <www-style@gtalbot.org>
- Date: Tue, 24 Apr 2012 17:55:12 -0400
- To: "Kang-Hao (Kenny) Lu" <kennyluck@csail.mit.edu>
- Cc: "WWW Style" <www-style@w3.org>
Le Mar 24 avril 2012 13:04, Kang-Hao (Kenny) Lu a écrit : > (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 I sincerly do not see a need to fix anything in CSS 2.1, section 15.3 with regards to this particular matter. > and this is > the subject of this thread. The initial post started with: 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. "in" is not "as" and quotation was apparently targeted on the font family names *containing* such keywords. Anyway,.. I really do not see the need to change anything in CSS 2.1, section 15.3 with regards to this precise matter. > >> 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 I will later create+file a bug report on this then. > 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. I created a test on your posted message { 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 } and based on Tab's chunk of code. > >> 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. 'foo, inherit' is not parsed as "<family-name> , <family-name>" 'foo, "inherit"' is parsed (and should be parsed) as "<family-name> , <family-name>" " 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 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. No. The single keyword 'inherit' can not match both the left hand side and the right hand side. As far as I understand this. E.g.: http://test.csswg.org/suites/css2.1/nightly-unstable/html4/font-family-rule-004.htm 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 21:55:46 UTC