Skip to content

animation shorthand first zero unit incorrectly dropped #988

Closed
@Meesayen

Description

@Meesayen

Environment

  • clean-css version - npm ls clean-css: 4.1.9
  • node.js version - node -v: 8.4.0
  • operating system: macOS El Capitan

Configuration options

var CleanCSS = require('clean-css');
new CleanCSS({
    level: 2,
    sourceMap: true,
    sourceMapInlineSources: true,
    returnPromise: true
})

Input CSS

.something {
  animation: 0s ease-out 5s forwards anim-name;
}

Actual output CSS

.something{animation:ease-out 5s forwards anim-name}

Expected output CSS

.something{animation:0s ease-out 5s forwards anim-name}

Hi, I found out that for some reasons the 0s unit in an animation shorthand is dropped, but in this case it can be a problem, because according to the specification the first time unit found in the shorthand is to be considered the "duration".

So in the example above, by dropping the zero unit, we are transforming a non-animated, 5 second delayed transition, to a 5 seconds long animated transition. (it was quite a fun bug to see :D)

I tried different configurations, like adding compatibility: { properties: { zeroUnits: false } }, with no success.

Using level: { 2: { skipProperties: ['animation'] } } helps but it would be nice to have those optimizations in place, clearly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions