brandonaaron / jquery-cssHooks

Collection of cssHooks that work with jQuery 1.4.3+
Other
478 stars 80 forks source link

normalize transitionTimingFunction values #11

Open burin opened 13 years ago

burin commented 13 years ago

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 commented 13 years ago

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

burin commented 13 years ago

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

pdokas commented 13 years ago

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.