Re: [css3-background] Further correction to the <position> grammar

(Editorial)

(12/01/21 12:04), Tab Atkins Jr. wrote:
> So, the grammar currently in the ED should remove its second clause -
> it's completely subsumed by the fourth clause.

I am against this. Explained below. (Context: the second clause was
[ left | center | right ] && [ top | center | bottom ] )

(12/01/23 7:16), Tab Atkins Jr. wrote:
> Because it more closely matches the actual productions.  In the ED
> version, the (A) clause covers all the 1-token productions, the (B)
> clause covers most of the 2-token productions (with the exception
> being [top|bottom] [left|right]), and the (C) clause covers everything
> else.

Why allow such an exception? I thought the point in the previous change
was to make it easier for casual readers to figure out what is valid or
what is not from the grammar. Do we expect people to get this part from
(C)? From my personal experience, that's pretty tricky.

Here's my story. I was reading this part of the section

  # If two values are given and at least one value is not a keyword,
  # then the first value represents the horizontal position (or offset)
  # and the second represents the vertical position (or offset).

and I pondered what "and at least on value value is not a keyword" is
there for for 30 minutes. I realized this is for excluding value in
[[top|bottom] [left|right|center] | center [left|right]] only after
bumping into this thread. This sentence, as it is, has two issues

1. It doesn't describe what should happen when the value consists of two
keywords, even for 'left top', which also satisfies "the first value
represents the horizontal position (or offset) and the second represents
the vertical position (or offset)".

2. It doesn't exclude values like 'top 10%', which meets the "at least
one value is not a keyword" condition but not the grammar.

Technically issue 1. is solved by later description of the keywords and
issue 2. is covered by the grammar, but having information spread out in
different places makes this hard to read. Therefore, I suggest we

A. Revise this sentence into something like

  | If two values are given, the first value represents the horizontal
  | position (or offset) and the second represents the vertical
  | position (or offset), unless one of these is ‘left’,
  | ‘right’, ‘top’ or ‘bottom’, which always represents a
  | predefined dimension (see below).

to address issue 1.

B. Bring [ left | center | right ] && [ top | center | bottom ] back to
the grammar or add an informative note:

  | Note that 'top left' is valid while 'top 0%' is not.

immediately after to address issue 2. (I actually like the original
proposal[1] better as it separates out 3-value cases involving 'center',
but well...)

[1] lists.w3.org/Archives/Public/www-style/2011May/0686


Cheers,
Kenny

Received on Tuesday, 6 March 2012 22:53:14 UTC