[css-grid] auto-repeat inside grid-template shorthand

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[css-grid] auto-repeat inside grid-template shorthand

Manuel Rego Casasnovas
Hi,

this is a similar mail to the previous one.

In the current syntax for grid-template [1] we have:
  [ <line-names>? <string> <track-size>? <line-names>? ]+
  [ / <track-list> ]?

This means that the following declaration would be invalid:
  grid-template: "a b"
                 "a b" / repeat(auto-fill, 100px);

I guess that as you are defining the grid areas,
you know the number of columns and don't need auto-repeat.

However, you can do something like this:
  grid-template: "a b"
                 "a b" / repeat(5, 100px);
Or:
  grid-template: "a b"
                 "a b" / 400px 200px 100px 50px;

And this is valid from the syntax point of view.

Do we really want to have an exception for auto-repeat here or not?

FWIW, right now it's valid in all auto-repeat implementations (Blink,
Webkit and Firefox).

Bye,
  Rego

[1] https://www.w3.org/TR/css-grid-1/#explicit-grid-shorthand

Reply | Threaded
Open this post in threaded view
|

Re: [css-grid] auto-repeat inside grid-template shorthand

Tab Atkins Jr.
On Mon, May 23, 2016 at 2:40 AM, Manuel Rego Casasnovas <[hidden email]> wrote:

> Hi,
>
> this is a similar mail to the previous one.
>
> In the current syntax for grid-template [1] we have:
>   [ <line-names>? <string> <track-size>? <line-names>? ]+
>   [ / <track-list> ]?
>
> This means that the following declaration would be invalid:
>   grid-template: "a b"
>                  "a b" / repeat(auto-fill, 100px);
>
> I guess that as you are defining the grid areas,
> you know the number of columns and don't need auto-repeat.
>
> However, you can do something like this:
>   grid-template: "a b"
>                  "a b" / repeat(5, 100px);
> Or:
>   grid-template: "a b"
>                  "a b" / 400px 200px 100px 50px;
>
> And this is valid from the syntax point of view.
>
> Do we really want to have an exception for auto-repeat here or not?
>
> FWIW, right now it's valid in all auto-repeat implementations (Blink,
> Webkit and Firefox).
>
> Bye,
>   Rego
>
> [1] https://www.w3.org/TR/css-grid-1/#explicit-grid-shorthand

The whole point of that branch of the grid-template grammar is to make
things line up ASCII-art-style.  Allowing repeat() in the column sizes
violates that; columns either don't get a corresponding size in the
track list, or line up badly.  Also, it's *really* nonsensical to
allow repeat() in the row-sizing part of the grammar, and it's bad to
be inconsistent and allow things in one spot but not the other.
Allowing the auto-repeat things in either of those makes even *less*
sense.

If it's an implementation burden, we can allow it, but I'd prefer to disallow.

(And we messed up - fixed-reps repeat() *shouldn't* be allowed in the
column-sizing part; we just referred to <track-list> without paying
enough attention.)

~TJ

Reply | Threaded
Open this post in threaded view
|

Re: [css-grid] auto-repeat inside grid-template shorthand

Manuel Rego Casasnovas

On 23/05/16 19:18, Tab Atkins Jr. wrote:

> The whole point of that branch of the grid-template grammar is to make
> things line up ASCII-art-style.  Allowing repeat() in the column sizes
> violates that; columns either don't get a corresponding size in the
> track list, or line up badly.  Also, it's *really* nonsensical to
> allow repeat() in the row-sizing part of the grammar, and it's bad to
> be inconsistent and allow things in one spot but not the other.
> Allowing the auto-repeat things in either of those makes even *less*
> sense.
>
> If it's an implementation burden, we can allow it, but I'd prefer to disallow.

No, it's not an issue for us. We just wanted to be sure
what was the purpose of the syntax.

> (And we messed up - fixed-reps repeat() *shouldn't* be allowed in the
> column-sizing part; we just referred to <track-list> without paying
> enough attention.)

So I guess you need to update the spec and avoid using <track-list>
directly on this case.

Bye,
  Rego

Reply | Threaded
Open this post in threaded view
|

Re: [css-grid] auto-repeat inside grid-template shorthand

Manuel Rego Casasnovas


On 23/05/16 23:36, Manuel Rego Casasnovas wrote:

> On 23/05/16 19:18, Tab Atkins Jr. wrote:
>> The whole point of that branch of the grid-template grammar is to make
>> things line up ASCII-art-style.  Allowing repeat() in the column sizes
>> violates that; columns either don't get a corresponding size in the
>> track list, or line up badly.  Also, it's *really* nonsensical to
>> allow repeat() in the row-sizing part of the grammar, and it's bad to
>> be inconsistent and allow things in one spot but not the other.
>> Allowing the auto-repeat things in either of those makes even *less*
>> sense.
>>
>> If it's an implementation burden, we can allow it, but I'd prefer to disallow.
>
> No, it's not an issue for us. We just wanted to be sure
> what was the purpose of the syntax.
>
>> (And we messed up - fixed-reps repeat() *shouldn't* be allowed in the
>> column-sizing part; we just referred to <track-list> without paying
>> enough attention.)
>
> So I guess you need to update the spec and avoid using <track-list>
> directly on this case.

A week has passed since the last confcall where the agreement was [1]:
"  - Tentatively the group resolved that auto-repeat should be
      invalid despite existing implementations. And remove the
      grammar that allows repeat() for columns as it was an accident.
      - If there are no objections on the mailing list before the
          next telecon, the group will formally resolve."

So I guess we can assume now that the syntax [2] will be modified and
repeat() won't be valid for columns when using the ASCII branch.

It'd be nice to get the spec updated as we'll be applying this on Blink
and WebKit in the coming days.

Bye,
  Rego

[1] https://lists.w3.org/Archives/Public/www-style/2016May/0231.html
[2] https://drafts.csswg.org/css-grid/#explicit-grid-shorthand