Side navigation
#13940 closed bug (duplicate)
Opened May 25, 2013 03:55PM UTC
Closed May 28, 2013 01:29PM UTC
Slide animation broken on jQuery 1.10.0 ?
Reported by: | johnny.shields@gmail.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.10.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I just upgraded to jQuery 1.10.0 from 1.9.1 and found that this animation breaks on multiple browsers--it slides very fast and twitches in a strange way:
$(document).on('click','#my-btn',function(){
$('#my-div').show('slide', 250);
});
I'm using jQuery UI 1.10.3 in both the failing jQuery 1.10.0 and successful jQuery 1.9.1 cases.
Oddly enough, the hide('slide',250) works as normal.
Attachments (0)
Change History (5)
Changed May 28, 2013 05:27AM UTC by comment:1
_comment0: | Yes,the same issue here \ \ a simple demo on jsFiddle \ change jquery version 1.10 to 1.9.1 to see the difference... \ http://jsfiddle.net/niphor/53Dxj/ \ \ 2.0.1 also have the same issue. → 1369720267534496 |
---|
Changed May 28, 2013 05:33AM UTC by comment:2
Yep, that's exactly the behavior I see.
Changed May 28, 2013 07:47AM UTC by comment:3
_comment0: | I trace the source code of 1.10.0 \ the problem is here: \ assume user's code is: \ {{{#!js \ $('#slide3').animate({ left: '+=200' }, 500); \ or \ $('#slide3').animate({ left: '+=200px' }, 500); \ }}} \ \ \ in the 'tweeners[*] ' at line 8830 of the source code,at this point: \ \ **//parts//** should be '''['+=200','+','100','']''' or '''['+=200','+','100','px']''' then: \ {{{#!js \ unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ) \ }}} \ jQuery.cssNumber[ prop ] eqs jQuery.cssNumber[ 'left' ], the value === null \ \ so: unit ==="px" \ {{{#!js \ start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && \ rfxnum.exec( jQuery.css( tween.elem, prop ) ) \ }}} \ \ then unit!=="px" always ===false \ \ so: start=false \ \ \ {{{#!js \ //line 8870 \ tween.end = parts[ 1 ] ?start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : +parts[ 2 ]; \ }}} \ because start=false ,start+(parts[1]+1)*parts[2] = false+ +1*200= 200 \ \ so:tween.end=200 \ \ but it should be 0; → 1369727325627065 |
---|
I trace the source code of 1.10.0
the problem is here:
assume user's code is:
$('#slide3').animate({ left: '+=200' }, 500); or $('#slide3').animate({ left: '+=200px' }, 500);
in the 'tweeners[*] ' at line 8830 of the source code,at this point:
**parts** should be '''['+=200','+','100',''] or ['+=200','+','100','px']''' then:
unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" )
jQuery.cssNumber[ prop ] eqs jQuery.cssNumber[ 'left' ], the value === null
so: unit ==="px"
start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && rfxnum.exec( jQuery.css( tween.elem, prop ) )
then unit!=="px" always ===false
so: start=false
//line 8870 tween.end = parts[ 1 ] ?start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : +parts[ 2 ];
because start=false ,start+(parts[1]+1)*parts[2] = false+ +1*200= 200
so:tween.end=200
but it should be 0;
Sorry for my poor English.
Changed May 28, 2013 11:17AM UTC by comment:4
I double that, and want to point that is same bug exists in 2.0.1 as well. Really stops from upgrading...
Yes,the same issue here
a simple demo on jsFiddle
change jquery version from 1.10 to 1.9.1 to see the difference...
http://jsfiddle.net/niphor/53Dxj/
2.0.1 also have the same issue.