Without this change animating properties from jQuery.cssNumber on non-elements
throws an error.
Ref gh-4055
Closes gh-4061
unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
// Starting value computation is required for potential unit mismatches
- initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
+ initialInUnit = elem.nodeType &&
+ ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
rcssNum.exec( jQuery.css( elem, prop ) );
if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
this.clock.tick( 200 );
} );
+QUnit.test( "animate non-element's zIndex without appending \"px\"", function( assert ) {
+ assert.expect( 1 );
+
+ var obj = { zIndex: 0 };
+
+ jQuery( obj ).animate( { zIndex: 200 }, 200, function() {
+ assert.equal( obj.zIndex, 200, "The custom property should be modified without appending \"px\"." );
+ } );
+ this.clock.tick( 200 );
+} );
+
QUnit.test( "stop()", function( assert ) {
assert.expect( 4 );