mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
CSS: Skip the px-appending logic for animations of non-element props
Without this change animating properties from jQuery.cssNumber on non-elements throws an error. Ref gh-4055 Closes gh-4061
This commit is contained in:
parent
7646836577
commit
f5e36bd8f2
@ -19,7 +19,8 @@ function adjustCSS( elem, prop, valueParts, tween ) {
|
||||
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 ) {
|
||||
|
11
test/unit/effects.js
vendored
11
test/unit/effects.js
vendored
@ -607,6 +607,17 @@ QUnit.test( "animate non-element", function( assert ) {
|
||||
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 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user