Skip to content

Omitting the unit on a time value is invalid #3

@avacariu

Description

@avacariu

Input: csscompressor.compress("transition: background-color 1s linear 0ms;")
Expected output: 'transition:background-color 1s linear 0ms;'
Actual output: 'transition:background-color 1s linear 0;'

According to the MDN page on , omitting the unit is only valid for , so when I use csscompressor, the declaration containing the 0ms or 0s is ignored by both Firefox and Chrome.

The same case is for <frequency>, and probably a few of the other ones, I think. Omitting the unit used to be valid in CSS2, but breaks in CSS3 unfortunately.

This is a fairly simple fix (removing the m?s from _zero_fmt_spec_re), and I'll create a PR and some tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions