Commit 499d7e40 authored by Corey Frang's avatar Corey Frang Committed by Dave Methvin

Ensuring that nulls in private data object won't cause errors on stop() - Fixes #10750

parent a467aa0a
...@@ -264,7 +264,7 @@ jQuery.fn.extend({ ...@@ -264,7 +264,7 @@ jQuery.fn.extend({
} }
return this.each(function() { return this.each(function() {
var i, var index,
hadTimers = false, hadTimers = false,
timers = jQuery.timers, timers = jQuery.timers,
data = jQuery._data( this ); data = jQuery._data( this );
...@@ -274,33 +274,33 @@ jQuery.fn.extend({ ...@@ -274,33 +274,33 @@ jQuery.fn.extend({
jQuery._unmark( true, this ); jQuery._unmark( true, this );
} }
function stopQueue( elem, data, i ) { function stopQueue( elem, data, index ) {
var hooks = data[ i ]; var hooks = data[ index ];
jQuery.removeData( elem, i, true ); jQuery.removeData( elem, index, true );
hooks.stop( gotoEnd ); hooks.stop( gotoEnd );
} }
if ( type == null ) { if ( type == null ) {
for ( i in data ) { for ( index in data ) {
if ( data[ i ].stop && i.indexOf(".run") === i.length - 4 ) { if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
stopQueue( this, data, i ); stopQueue( this, data, index );
} }
} }
} else if ( data[ i = type + ".run" ] && data[ i ].stop ){ } else if ( data[ index = type + ".run" ] && data[ index ].stop ){
stopQueue( this, data, i ); stopQueue( this, data, index );
} }
for ( i = timers.length; i--; ) { for ( index = timers.length; index--; ) {
if ( timers[ i ].elem === this && (type == null || timers[ i ].queue === type) ) { if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
if ( gotoEnd ) { if ( gotoEnd ) {
// force the next step to be the last // force the next step to be the last
timers[ i ]( true ); timers[ index ]( true );
} else { } else {
timers[ i ].saveState(); timers[ index ].saveState();
} }
hadTimers = true; hadTimers = true;
timers.splice( i, 1 ); timers.splice( index, 1 );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment