diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2018-02-24 17:17:24 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2018-03-19 20:33:35 -0400 |
commit | 2b5f5d5e90b37f4a735738a6d0b6f22affbea340 (patch) | |
tree | c6994421cc716eacba0d687b27a653a70d558558 /src/css.js | |
parent | b95e0da68e1e3fce59a6a54c209b893f611b0b9c (diff) | |
download | jquery-2b5f5d5e90b37f4a735738a6d0b6f22affbea340.tar.gz jquery-2b5f5d5e90b37f4a735738a6d0b6f22affbea340.zip |
CSS: Avoid filling jQuery.cssProps
Fixes gh-3986
Closes gh-4005
Avoids filling jQuery.cssProps by introducing a second internal
prop cache. This allows jQuery Migrate to detect external usage.
Diffstat (limited to 'src/css.js')
-rw-r--r-- | src/css.js | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/src/css.js b/src/css.js index 43e427472..bef7c7b73 100644 --- a/src/css.js +++ b/src/css.js @@ -13,12 +13,13 @@ define( [ "./css/adjustCSS", "./css/addGetHookIf", "./css/support", + "./css/finalPropName", "./core/init", "./core/ready", "./selector" // contains ], function( jQuery, pnum, access, camelCase, document, rcssNum, rnumnonpx, cssExpand, - getStyles, swap, curCSS, adjustCSS, addGetHookIf, support ) { + getStyles, swap, curCSS, adjustCSS, addGetHookIf, support, finalPropName ) { "use strict"; @@ -33,40 +34,7 @@ var cssNormalTransform = { letterSpacing: "0", fontWeight: "400" - }, - - cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style; - -// Return a css property mapped to a potentially vendor prefixed property -function vendorPropName( name ) { - - // Shortcut for names that are not vendor prefixed - if ( name in emptyStyle ) { - return name; - } - - // Check for vendor prefixed names - var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in emptyStyle ) { - return name; - } - } -} - -// Return a property mapped along what jQuery.cssProps suggests or to -// a vendor prefixed property. -function finalPropName( name ) { - var ret = jQuery.cssProps[ name ]; - if ( !ret ) { - ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; - } - return ret; -} + }; function setPositiveNumber( elem, value, subtract ) { |