Repository: jquery/jquery
File: test/unit/css.js (JavaScript)

Code before:
		assert.expect( !!appearanceName + !!transformName + 1 );

		elem = jQuery( "<div></div>" )
			.css( {
				msAppearance: "none",
				appearance: "none",

				// Only the ms prefix is used to make sure we haven't e.g. set
				// webkitTransform ourselves in the test.
				msTransform: transformVal,
				transform: transformVal
			} );
		elemStyle = elem[ 0 ].style;

		if ( appearanceName ) {
			assert.equal( elemStyle[ appearanceName ], "none", "setting properly-prefixed appearance" );
		}
		if ( transformName ) {
			assert.equal( elemStyle[ transformName ], transformVal, "setting properly-prefixed transform" );
		}
		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( "<div></div>" ),
		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( "<div></div>" ),
		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.

Review comment (performance):
```suggestion
QUnit.test( "Don't set prefixed versions of fake properties", function( assert ) {
```

Since the cache is gone.

Code after:
		assert.expect( !!appearanceName + !!transformName + 1 );

		elem = jQuery( "<div></div>" )
			.css( {
				msAppearance: "none",
				appearance: "none",

				// Only the ms prefix is used to make sure we haven't e.g. set
				// webkitTransform ourselves in the test.
				msTransform: transformVal,
				transform: transformVal
			} );
		elemStyle = elem[ 0 ].style;

		if ( appearanceName ) {
			assert.equal( elemStyle[ appearanceName ], "none", "setting properly-prefixed appearance" );
		}
		if ( transformName ) {
			assert.equal( elemStyle[ transformName ], transformVal, "setting properly-prefixed transform" );
		}
		assert.equal( elemStyle.undefined, undefined, "Nothing writes to node.style.undefined" );
	} );

} )();

QUnit.test( "Don't update existing unsupported prefixed properties", function( assert ) {
	assert.expect( 1 );

	var elem = jQuery( "<div></div>" ),
		style = elem[ 0 ].style;
	style.MozFakeProperty = "old value";
	elem.css( "fakeProperty", "new value" );

	assert.equal( style.MozFakeProperty, "old value", "Fake prefixed property is not set" );
} );

QUnit.test( "Don't set fake prefixed properties when a regular one is missing", function( assert ) {
	assert.expect( 5 );

	var elem = jQuery( "<div></div>" ),
		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.