Description
We're currently appending px
when using the .css()
setter if the value given is numeric and the CSS property is not on the jQuery.cssNumber
list.
From #2793 (comment):
This is a mess, we're adding more & more stuff to this array and it'll always be a problem as CSS is expanding. I'd like to get rid of this
px
-appending but it might be too big a breaking change.This is probably too late for 3.0 but how about switching the blacklist to a whitelist? If jQuery doesn't append
px
for you it's easier to fix by yourself than if it does append erroneously. My guess would be 99% of the uses are common properties like(min-|max-|)(height|width)
ortop
,left
etc. We could identify those most popular ones and appendpx
only to them. Migrate could restore the previous behavior but warn if someone passes a numeric value to properties that are not on the current blacklist.