- Notifications
You must be signed in to change notification settings - Fork20.6k
Description
We're currently appendingpx
when using the.css()
setter if the value given is numeric and the CSS property is not on thejQuery.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.