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

[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:28:57 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-515392946-1572524936-sysbot+gh@w3.org>
Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-grid] Resolved values of grid-template-rows/columns don't round-trip ==
According to @fantasai in https://github.com/w3c/csswg-drafts/issues/4444#issuecomment-548006702,

> Roundtripping getComputedStyle() values is probably the most fundamental rule about defining them.

However, `grid-template-rows` and `grid-template-columns` don't always round-trip. That's because they set explicit tracks, which start just after the 1st grid line. However, when serialized, they also include implicit tracks, which may exist before the 1st grid line.

```js
gridContainer.style.gridAutoRows = "1px";
gridContainer.style.gridTemplateRows = "2px";
var cs = getComputedStyle(gridContainer);
cs.gridTemplateRows; // "2px"
gridItem.style.gridRow = "auto / 1";
gridContainer.style.gridTemplateRows = cs.gridTemplateRows; // "1px 2px"
gridContainer.style.gridTemplateRows = cs.gridTemplateRows; // "1px 1px 2px"
gridContainer.style.gridTemplateRows = cs.gridTemplateRows; // "1px 1px 1px 2px"
gridContainer.style.gridTemplateRows = cs.gridTemplateRows; // "1px 1px 1px 1px 2px"
```

On the one hand, knowing the final size of these implicit tracks can be useful. On the other hand, failing to round-trip sucks.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4475 using your GitHub account
Received on Thursday, 31 October 2019 12:28:59 UTC

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