On 03/24/2010 06:57 PM, John Daggett wrote:
> fantasai wrote:
>
>> I'm not sure what you're getting at here. They should both be invalid, because
>> lining-nums and oldstyle-nums are mutually exclusive.
>>
>> Meaning, font-variant's grammar should be rewritten as
>>
>> normal | inherit | [<ligature-values> ||<alternates-values> ||<caps-value>
>> ||<numeric-values> ||<east-asian-variations> ]
>
> That has the downside that this would be invalid:
>
> font-variant: oldstyle-nums additional-ligatures slashed-zero;
>
> This is because 'oldstyle-nums' and 'slashed-zero' are both from the
> <numeric-values> production.
>
> Stated generally, I don't think the double-bar operator used in CSS
> grammar rules is associative:
>
> (a || b) || c != a || (b || c)
>
> In one case 'c a b' would be valid, in the other not.
Hm, that's a good point. The shorthand would need a more expanded-out
grammar to make that work.
> I guess one solution would be to simply expand out the full list of
> mutually exclusive properties but I think there's still a risk that
> cutting-and-pasting authors could accidently introduce invalid
> font-variant strings. My initial grammar simply allowed multiple
> mutually exclusive values in the syntax and resolved it at use, with
> the later value taking precedence.
I don't think it makes sense to allow mutually exclusive values in the
syntax and then ignore one of them. We overwrite earlier declarations
with later declarations, but I don't know of any other property in which
an earlier *value* is ignored when overwritten by a later value in the
same declaration. I'd rather make it invalid, so that the author has a
clue that something's not quite right (because the UA throws out the
whole rule) and so that the validator can catch what's almost certainly
an authoring error.
~fantasai