W3C home > Mailing lists > Public > www-style@w3.org > February 2014

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 4 Feb 2014 11:26:31 -0800
Message-ID: <CAAWBYDACXMw6bA4d6C2vorbGV-L4avCecjmwu0AJPU+bMUGxsQ@mail.gmail.com>
To: Javier Fernandez <jfernandez@igalia.com>
Cc: www-style list <www-style@w3.org>
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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:18 UTC