W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2019

Re: [csswg-drafts] [css-grid] Resolved values of grid-template-rows/columns don't round-trip (#4475)

From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
Date: Thu, 31 Oct 2019 12:29:59 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-548349785-1572524998-sysbot+gh@w3.org>
I have been thinking that we may be able to keep leading implicit tracks in the resolved value and also ensure round-tripping. We only need to allow `grid-template-rows` and `grid-template-columns` to define explicit tracks before the grid line number 1.

The current basic syntax is
```
<explicit-track-list> = [ <line-names>? <track-size> ]+ <line-names>?
<line-names>          = '[' <custom-ident>* ']'
```

Maybe we could change `<line-names>` to `'[' <custom-ident>* || 1? ']'`, with the constraint that this `1` can only appear once in the `<explicit-track-list>`.

This would define that line name to be the number 1. Tracks before that line would belong to the explicit grid, but items wouldn't be able to use integers in `grid-row/column` to be placed in such tracks (since 0 is invalid and negative integers refer to the end). Items could still reference line names in order to be placed there.

Then resolved values could preserve this `1` line name if it was specified, and otherwise it could be inserted when there are leading implicit tracks. The previous example would become
```js
cs.gridTemplateRows; // "2px"
gridItem.style.gridRow = "auto / 1";
gridContainer.style.gridTemplateRows = cs.gridTemplateRows; // "1px [1] 2px"
gridContainer.style.gridTemplateRows = cs.gridTemplateRows; // "1px [1] 2px"
```

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4475#issuecomment-548349785 using your GitHub account
Received on Thursday, 31 October 2019 12:30:01 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:55 UTC