W3C home > Mailing lists > Public > www-style@w3.org > December 2011

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 20 Dec 2011 07:49:28 -0800
Message-ID: <CAAWBYDC-OfwtEe8h=XSekmqRkrCiXdETmb4weYk0EsAWGhoe6g@mail.gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: www-style@w3.org
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

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:07 UTC