Re: [css3-background] Overly-clever background-position grammar

On Mon, Dec 19, 2011 at 7:54 PM, fantasai <fantasai.lists@inkedblade.net> wrote:
> Unfortunately, your grammar is technically incorrect. If you are using
> the two-value form with either <percentage> or <length>, it must be
> in horizontal-then-vertical order. Your grammar admits '50% left',
> which is invalid per CSS2.1.
>
> I'm not against changing the grammar to be more understandable, but I
> won't change it to be less correct.
>
> Filed as ISSUE-212
>  https://www.w3.org/Style/CSS/Tracker/issues/212

Ah, you're right.  I never understood that restriction (it's
unambiguous, after all), so I hadn't kept it in mind.  Here's a
corrected verbose version:

<bg-position> = [
 [ <percentage> | <length> | left | center | right | top | bottom ]
|
 [ left | center | right ] &&
 [ top | center | bottom ]
|
 [ <percentage> | <length> | left | center | right ]
 [ <percentage> | <length> | top | center | bottom ]
|
 center &&
 [ [ left | right | top | bottom ] [ <percentage> | <length> ] ]
|
 [ [ left | right ] [ <percentage> | <length> ]? ] &&
 [ [ top | bottom ] [ <percentage> | <length> ]? ]
]

The 2-value clause has now been split into two pieces, the first which
is pure keywords and allows reordering, the second which includes
<percentage> and <length> and doesn't allow reorderingn.

~TJ

Received on Tuesday, 20 December 2011 15:50:20 UTC