Re: [css-grid] Implicit Named Areas

On Mon, Oct 5, 2015 at 10:26 AM, Mats Palmgren <mats@mozilla.com> wrote:
> I find the chapter on Implicit Named Areas:
> https://drafts.csswg.org/css-grid/#implicit-named-areas
> lacking in details on when and how such an implicit area is created.

The spec doesn't actually "create" any such areas; they exist as a
spec concept for convenience only.  The placement properties never
care about areas, they just check for lines with particular names.

> For example, is an implicit named area A created in any of the
> following cases? (assume 'grid-template-rows:40px' for now)
>
> 1: grid-template-columns: [A-start] 40px [] 40px;
>
> 2: grid-template-columns: [A-end] 40px [] 40px;
>
> 3: grid-template-columns: 40px [A-end] 40px;
>
> 4: grid-template-columns: [A-end] 40px [A-start] 40px;
>
> 5: grid-template-columns: 40px [] 40px [A-start];
>
> 6: grid-template-columns: 40px [A-start] 40px;
>
> 7: grid-template-columns: [A-start] 40px [A-end] 40px [A-start] 40px;
>
> 8: grid-template-columns: [A-start] 40px [A-start] 40px [A-end] 40px;
>
> 9: grid-template-columns: [A-start] 40px [A-end] 40px [A-end];
>
> 10: grid-template-columns: [A-end A-start] 40px [] 40px;
>
> 11: grid-template-columns: 40px [A-end A-start] 40px;
>
> 12: grid-template-columns: 40px [A-start A-end] 40px;
>
> 13: grid-template-columns: 40px [] 40px [A-end A-start];
>
> If an area is created, at which lines does it start and end?
>
> Are A-start/A-end lines in both dimensions required for
> an implicit named area to be created?  For example, if I use
> 'grid-template-rows:[A-start] 40px [A-end]' together with the
> declarations above, does that change the answers in any way?
>
> The results of these examples in Firefox and Chrome are very
> different, so I'd like to know what the exact rules are.

If you said "grid-column-start: A", then it will first look for lines
named A-start to match against, and failing that, will look for lines
named A.  Same for grid-column-end and A-end.  That's it.  Whether or
not lines named A-start or A-end exist, or their relative
distribution, makes no difference whatsoever.  There is no "A area",
implicit or otherwise, that is looked for.

(If you want to force it to look for lines named A and ignore anything
named A-start, you can write "grid-column-start: A 1"; that forces it
down the "must be a line name" grammar path.  Just using a single
keyword is ambiguous, so it tries it both ways.)

If either browser is doing something different, they're violating the spec.

~TJ

Received on Tuesday, 6 October 2015 20:18:04 UTC