Skip to content

[cssom-1] Spec disagrees with WPT on resolution and time serialization #12616

@AtkinsSJ

Description

@AtkinsSJ

The spec says to always serialize a <resolution> as dppx:

<resolution>
The resolution in dots per CSS pixel 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.

EDIT: <time> is a more compelling case: Both css/css-transitions/parsing/transition-duration-valid.html and css/css-transitions/parsing/transition-delay-valid.html expect it to be serialized using its specified units.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions