wpt
wpt copied to clipboard
Don't serialize shorthand when not all subproperties have initial values
This test case corresponds to a current round trip issue in Chrome/Firefox (at least): grid serializes to 'none' even if grid-template-areas is declared to a non-initial value.
This test case corresponds to a current round trip issue in Chrome/Firefox
Firefox and WebKit seem fine for me. Just Blink is wrong
Sure. I have already spent some time analyzing the conditions for which grid
or grid-template
should not be serialized, and to figure out how to formulate these conditions in the most simple terms. However it does not surprise me that I missed grid: auto-flow 1px/2px; grid-auto-columns: 3px
as I had decided to come back later to it with a fresh look. Furthermore, I was quite confident for this simple test but ideally I should run new tests locally and I might struggle to do so as I am using a virtual machine to keep my host machine "clean". But I can still open the HTML test file directl and running wpt lint
should be enough, of course.
TLDR: I will do it later but feel free to replace this PR if you do not want to wait.
Superseded by #36217
Oriol (or anyone interested), I leave you my notes in case you want to review/complete tests about serializing grid
/grid-template
to empty string when it cannot represent all its sub-properties.
grid-template
It is assumed that
grid-template-rows
,grid-template-columns
,grid-template-areas
, have a declaration.
grid-template
cannot represent all its sub-properties whengrid-template-areas
is not declared to its initial value (none
) and some of these conditions is truthy:
grid-template-rows
matchesnone
grid-template-rows
defines less/more<track-size>
s than<string>
(rows) ingrid-template-areas
grid-template-rows|columns
matches<track-list>
expanded with<track-repeat>
grid-template-rows|columns
matches<auto-track-list>
grid-template-rows|columns
matchessubgrid <line-name-list>?
Alternatively, the last three conditions can be expressed as follows to guide implementation rather than tests:
grid-template-rows
matches<track-list>
expanded with<track-size>
grid-template-columns
matches eithernone
,<track-list>
expanded with<track-size>
(explicit track list), or<explicit-track-list>
grid
It is assumed that
grid-template-rows
,grid-template-columns
,grid-template-areas
,grid-auto-fow
,grid-auto-rows
,grid-auto-columns
, have a declaration.
grid
cannot represent all its sub-properties when some of these conditions is truthy:
grid-auto-*
are declared to their initial value (auto
) and the serialization ofgrid-template
is empty string- both axis have declarations defining an implicit track list
- some axis has declarations defining both an explicit and implicit track lists