[csswg-drafts] [css-grid] Clarify that line 1 is never implicit (#5122)

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-grid] Clarify that line 1 is never implicit ==
Consider https://software.hixie.ch/utilities/js/live-dom-viewer/saved/8137

```css
#grid {
  display: grid;
  grid-template-columns: none;
  grid-template-areas: none;
}
#grid-item {
  grid-column-start: foo 1;
}
```

According to https://drafts.csswg.org/css-grid/#grid-placement-int,

>If a name is given as a `<custom-ident>`, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position.

There is no explicit line called `foo`, so `grid-column-start: foo 1` should resolve to the 1st trailing implicit line. But, which one is the 1st one? According to https://drafts.csswg.org/css-grid/#implicit-grids,

> The `grid-template-rows`, `grid-template-columns`, and `grid-template-areas` properties define a fixed number of tracks that form the explicit grid. When grid items are positioned outside of these bounds, the grid container generates implicit grid tracks by adding implicit grid lines to the grid.

So if there are `n > 0` tracks in the explicit grid, then it's easy: the explicit grid is delimited by lines `1` and `n+1`, so the 1st trailing implicit line is the `n+2`.

But in this case we don't have any explicit column, i.e. we have `n = 0`. From https://drafts.csswg.org/css-grid/#grid-line-concept,

> A grid line exists on either side of a column or row.

So if there is no explicit column, it wouldn't be unreasonable to think that there is no explicit line. That is, creating the 1st trailing implicit track would add two implicit lines, `1` and `2`. Then, line `1` would be implicit.

However, we have interoperability that the 1st trailing implicit line is `2`, not `1`. I think this is good, just substitute `n = 0` into the `n+2` formula above, no need to special case `n = 0`.

So I think it should be clarified that line `1` (and `-1`) is never implicit, even if the explicit grid is empty. Or that line ` is 1` not considered to have all names.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5122 using your GitHub account

Received on Wednesday, 27 May 2020 14:09:39 UTC