Re: css3-background: grammar issue

On Tue, 23 Feb 2010, Brad Kemper wrote:

>
> On Feb 23, 2010, at 6:45 PM, Yves Lafon wrote:
>
>>> - Change the token '/' to the keyword 'as'
>>> - Replace
>>>     # where ?<bg-position>? must occur before ?/ <bg-size>? if both are present.
>>>   with
>>>     | where '<bg-position>' must not occur immediately after 'as <bg-size>'
>>>
>>> Would this address your concerns?
>>
>> Replacing '/' by 'as' will indeed help. The second rule was more an example that there were "more restrictive than necessary" rules and just adding one to forbid '/' being first was not out of the line. But the new wording, "must not occur immediately" will make it easier to check anyway, so OK for both.
>
> This does not seem to me like the right thing to do. The 
> arbitrary-seeming rule to disallow a slash+background-size at the 
> beginning seems to me to be "more restrictive than necessary". The slash 
> has been established elsewhere (such as in border-image) as a 
> disambiguating divider, and that seems very clear to me; much more so 
> than "as" as a disambiguating prefix word. When one thinks of 1-2 
> lengths or percentages as meaning 'background-size' when found anywhere 
> after a slash, and as meaning 'background-position' otherwise, then it 
> is very clear, and no further restrictions are needed. I think all the 
> following should be equally valid, as all seem equally clear:

The issue comes from the fact that bg-size and bg-position have the same 
syntax, so one way of fixing this could be to englobe size in a function, 
like background: size(10% 90%), but it doesn't fly well with 
background-size: size(10% 90%).

But why choosing '/' which is a CSS2 operator ? Choosing 'as' is a far 
better choice than '/' for this reason (but it could be anything that 
would be parsed as something else than an operator.

> background: url(img.png);
> background: 10% 90%;  /* bg-position */
> background: / 10% 90%;  /* bg-size */
> background: 10% 90% / 10% 90%; /* bg-position, then bg-size */
>
> I think it would be confusing for authors to have to remember that for 
> some reason they could not have just a bg-size as the singleton value 
> for their shorthand just because it still required a slash to its left. 
> And I really do not think it is improved by having "as" instead of "/" 
> as the required text to its left. Of the following four choices, I much 
> prefer the first:

I think that 'size' is far more readable for authors than '/'. Another 
solution is to forbid size in the background shorthand property.

> background: / 10% 90%;
> background: as 10% 90%;
> background: size 10% 90%;
> background: some-other-text 10% 90%;
>
> As for this:
>
>> background: url("foo.png") / 10em black 10em
>
> ...it just doesn't make any sense to me. The first 10em must be bg-size, 
> because it is after the slash, but then there is a second 10em 
> (separate, due to the 'black') after the slash too? How can that be 
> interpreted as anything other than a mistake, when slashes are used to 
> separate and group the values of the shorthand, same as in border-image?

slash is used to identify bg-size, but you are right, slash is an operator 
used to separate and group values, which is not what it does when it 
appears first (same with comma).

-- 
Baroula que barouleras, au tiéu toujou t'entourneras.

         ~~Yves

Received on Tuesday, 23 February 2010 13:32:56 UTC