[CSS3] @font vs @background

As for the moment CSS has three "sequence operators" in its grammar:

1. ' ' (whitespace) - it is a token delimiter and also list
    joining operator.
2. ',' (comma) list joining operator and
3  '/' (slash) list joining operator (used to make single value from
    pair of values).

Problem with space and comma operators.

Consider font and proposed multi-background declaration:

font: 12pt Arial, sans-serif;
background: url(1.gif) repeat, url(2.gif) no-repeat;

For the font, ',' comma, as an operator, has higher precedence
than space and in background it is vice versa - space is of higher
precedence.

This can demonstrated by using "priority" brackets:

font: (12pt) (Arial, sans-serif);
background: (url repeat), (url no-repeat);

(Arial, sans-serif) list is a single value of <font-family>.

Clearly these two properties are using different syntaxes/grammar rules
so parsing of such properties is context (property name) sensitive.

Such situation is highly non-desirable in my opinion. I tend to classify
as a bug of language design.

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Friday, 5 February 2010 04:05:08 UTC