jquery-cssHooks icon indicating copy to clipboard operation
jquery-cssHooks copied to clipboard

normalize transitionTimingFunction values

Open burin opened this issue 14 years ago • 3 comments

When setting transitionTimingFunction as "linear":

Safari 5.0.1 Mac returns "cubic-bezier(0, 0, 1, 1)"

Chrome 8.0.552.23 dev Mac returns "linear"

Tests were written to expect "cubic-bezier(0, 0, 1, 1)", so they fail in Chrome

burin avatar Nov 02 '10 23:11 burin

Firefox 4.0 beta Mac returns "border 1s cubic-bezier(0.000000, 0.000000, 1.000000, 1.000000)"

burin avatar Nov 10 '10 05:11 burin

is it reasonable to expect "linear" back if you set it as "linear"?

burin avatar Nov 10 '10 21:11 burin

I suggest normalizing on the cubic-bezier() functions. All the named shortcuts come with official definitions in the spec so we can easily map name --> function params. From there if we normalize the params by ramming them through Number() we will probably wind up with predictable values.

The one possible danger I see in doing so is possible floating point oddness. I'd be surprised frankly to see it come up, but it's something to watch out for.

pdokas avatar Nov 10 '10 22:11 pdokas