diff --git a/src/css/finalPropName.js b/src/css/finalPropName.js index b11e92394..f040e6976 100644 --- a/src/css/finalPropName.js +++ b/src/css/finalPropName.js @@ -1,8 +1,7 @@ import { document } from "../var/document.js"; var cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style, - vendorProps = {}; + emptyStyle = document.createElement( "div" ).style; // Return a vendor-prefixed property or undefined function vendorPropName( name ) { @@ -21,13 +20,8 @@ function vendorPropName( name ) { // Return a potentially-mapped vendor prefixed property export function finalPropName( name ) { - var final = vendorProps[ name ]; - - if ( final ) { - return final; - } if ( name in emptyStyle ) { return name; } - return vendorProps[ name ] = vendorPropName( name ) || name; + return vendorPropName( name ) || name; } diff --git a/test/unit/css.js b/test/unit/css.js index d872e52bb..0c31e36eb 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1759,19 +1759,33 @@ QUnit.test( "Do not throw on frame elements from css method (trac-15098)", funct assert.equal( elemStyle.undefined, undefined, "Nothing writes to node.style.undefined" ); } ); - QUnit.test( "Don't detect fake set properties on a node when caching the prefixed version", function( assert ) { - assert.expect( 1 ); - - var elem = jQuery( "
" ), - style = elem[ 0 ].style; - style.MozFakeProperty = "old value"; - elem.css( "fakeProperty", "new value" ); - - assert.equal( style.MozFakeProperty, "old value", "Fake prefixed property is not cached" ); - } ); - } )(); +QUnit.test( "Don't detect fake set properties on a node when caching the prefixed version", function( assert ) { + assert.expect( 1 ); + + var elem = jQuery( "
" ), + style = elem[ 0 ].style; + style.MozFakeProperty = "old value"; + elem.css( "fakeProperty", "new value" ); + + assert.equal( style.MozFakeProperty, "old value", "Fake prefixed property is not cached" ); +} ); + +QUnit.test( "Don't set fake prefixed properties when a regular one is missing", function( assert ) { + assert.expect( 5 ); + + var elem = jQuery( "
" ), + style = elem[ 0 ].style; + elem.css( "fakeProperty", "fake value" ); + + assert.strictEqual( style.fakeProperty, "fake value", "Fake unprefixed property is set" ); + assert.strictEqual( style.webkitFakeProperty, undefined, "Fake prefixed property is not set (webkit)" ); + assert.strictEqual( style.WebkitFakeProperty, undefined, "Fake prefixed property is not set (Webkit)" ); + assert.strictEqual( style.MozFakeProperty, undefined, "Fake prefixed property is not set (Moz)" ); + assert.strictEqual( style.msFakeProperty, undefined, "Fake prefixed property is not set (ms)" ); +} ); + // IE doesn't support CSS variables. QUnit.testUnlessIE( "css(--customProperty)", function( assert ) {