[csswg-drafts] [cssom-1] Spec disagrees with WPT on resolution serialization (#12616)

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

== [cssom-1] Spec disagrees with WPT on resolution serialization ==
The spec [says](https://drafts.csswg.org/cssom/#serialize-a-css-value) to always serialize a `<resolution>` as `dppx`:

> [`<resolution>`](https://drafts.csswg.org/css-values-4/#resolution-value)
>    The resolution in dots per [CSS pixel](https://drafts.csswg.org/css-values-4/#px) serialized as per `<number>` followed by the literal string "dppx".

However, actually doing this breaks a few subtests of https://wpt.live/css/mediaqueries/match-media-parsing.html , because the media queries are expected to serialize using their specified units.

Technically, media query serialization doesn't use that value-serialization part of the spec, but it's mostly missing so I think it's reasonable to serialize media-feature values like regular property values.

The definition for `<time>` also specifies to always serialize in `s` units. Other dimensions serialize using whatever their specified unit is. Is this distinction important? I can't think of a particular reason why these would serialize differently. I'd actually propose combining all the dimension branches in https://drafts.csswg.org/cssom/#serialize-a-css-value together, using the text for `<length>`:
> The `<number>` component serialized as per `<number>` followed by the unit in its canonical form as defined in its respective specification. 

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 18 August 2025 13:03:48 UTC