Re: [css-grid] grid-template shorthand issues

On Mon, Feb 3, 2014 at 11:56 AM, Javier Fernandez <jfernandez@igalia.com> wrote:
> Hi,
>
> I'm trying to implement the "template-grid" shorthand following the
> latest specification, but I'm having some problems trying to understand
> the last syntax form:
>
> [ <track-list> / ]? [ <line-names>? <string> [ <track-size> <line-names>
> ]? ]+
>
> The description of the last component,  " [ <track-size> <line-names> ]?
> ",  indicates the following:
>
> * Sets "grid-template-rows" to the <track-size>s following each string
> (filling in auto for any missing sizes), and splicing in the named lines
> defined before/after each size.
>
> First question is, wouldn't be necessary, or clearer, to add an "OR" to
> such clause ? perhaps something like  " [ <track-size>  | <line-names>
> ]? "  ? or does the original clause mean that any of the elements inside
> the [] are optional ?

Ah, that is a mistake.  Instead of having brackets around them and
making the pair optional, each one should be optional by itself, like
"<track-size>? <line-names>?".

> Also, wouldn't be clearer to define this shorthand in a way more
> consistent with the track-list definition, so as the track-size would be
> mandatory ?

I don't think so.  An omitted track size is just "auto", which seems
pretty reasonable.

> I have some other doubts on the use of brackets, for instance, in the
> "grid-line" syntax definition:
>
>   <grid-line> =
>     auto |
>     <custom-ident> |
>     [ <integer> && <custom-ident>? ] |
>     [ span && [ <integer> || <custom-ident> ] ]
>
> In that case," [ <integer> && <custom-ident>? ] " wouldn't be clearer "
> [<integer> [&& <custom-ident>] "

I don't understand.  Your suggested correction isn't well-formed.

~TJ

Received on Tuesday, 4 February 2014 19:27:33 UTC