Skip to content

transitionProperty and transitionTimingFunction not prefixed uniformly #154

@jjjreisss

Description

@jjjreisss

Background: In plain CSS, transition-property and transition-timing-function are interdependent.

.myClass {
  transition-property: 'property-1, property2, property-3';
  transition-timing-function: 'function-1, function-2, function3';
}

function-1 applies to property-1, function-2 to property-2, function-3 to property-3.

This is interdependence is not respected by inline-style-prefixer.

Consider the following code:

import Prefixer from 'inline-style-prefixer'

const originalStyle = {
  transitionProperty: 'transform, opacity',
  transitionTimingFunction: 'ease, step-end'
}

const prefixer = new Prefixer()
const prefixedStyle = prefixer.prefix(originalStyle)

console.log(prefixedStyle);

Expectation: ease applies to the transform transition, step-end applies to opacity
Reality: In this above block of code, the stdout is

{
  transitionProperty: '-webkit-transform, transform, opacity',
  transitionTimingFunction: 'ease, step-end',
  WebkitTransitionProperty: '-webkit-transform, transform, opacity',
  MozTransitionProperty: 'transform, opacity'
}

In particular, notice that transitionProperty now has three list items, but transitionTimingFunction still has two.

If we applied this style object to a DOM node, ease would apply to -webkit-transform, step-end to transform, and no timing function would be applied to opacity.

This bug was surfaced in necolas/react-native-web#852

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions