diff options
author | timmywil <timmywillisn@gmail.com> | 2011-09-12 19:48:44 -0400 |
---|---|---|
committer | timmywil <timmywillisn@gmail.com> | 2011-09-19 15:42:30 -0400 |
commit | 1878885fb7a09b65d95980a9b7dce2df2944e4f9 (patch) | |
tree | 6d70ba76b3dc9a26085ce9cdec9fcf68bb02cd3d /src/queue.js | |
parent | 92405d4f5ffe9ec1f26f280303783014948438c5 (diff) | |
download | jquery-1878885fb7a09b65d95980a9b7dce2df2944e4f9.tar.gz jquery-1878885fb7a09b65d95980a9b7dce2df2944e4f9.zip |
Animation state is tracked on toggled/stopped animations using the private data cache. Fixes #8685. See full commit message for more. Fixes #6641.
- Example: http://jsfiddle.net/timmywil/gqZL5/24/
- http://bugs.jquery.com/ticket/8685
- Check the completed timer has not been removed already so other timers do not get accidentally removed. Fixes #6641.
- Style edits, code reductions, and optimizations for the effects module
Diffstat (limited to 'src/queue.js')
-rw-r--r-- | src/queue.js | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/queue.js b/src/queue.js index 66383c190..cd6aeb26b 100644 --- a/src/queue.js +++ b/src/queue.js @@ -4,15 +4,15 @@ function handleQueueMarkDefer( elem, type, src ) { var deferDataKey = type + "defer", queueDataKey = type + "queue", markDataKey = type + "mark", - defer = jQuery.data( elem, deferDataKey, undefined, true ); + defer = jQuery._data( elem, deferDataKey ); if ( defer && - ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) && - ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) { + ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && + ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { // Give room for hard-coded callbacks to fire first // and eventually mark/queue something else on the element setTimeout( function() { - if ( !jQuery.data( elem, queueDataKey, undefined, true ) && - !jQuery.data( elem, markDataKey, undefined, true ) ) { + if ( !jQuery._data( elem, queueDataKey ) && + !jQuery._data( elem, markDataKey ) ) { jQuery.removeData( elem, deferDataKey, true ); defer.resolve(); } @@ -25,7 +25,7 @@ jQuery.extend({ _mark: function( elem, type ) { if ( elem ) { type = (type || "fx") + "mark"; - jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true ); + jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); } }, @@ -38,9 +38,9 @@ jQuery.extend({ if ( elem ) { type = type || "fx"; var key = type + "mark", - count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 ); + count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); if ( count ) { - jQuery.data( elem, key, count, true ); + jQuery._data( elem, key, count ); } else { jQuery.removeData( elem, key, true ); handleQueueMarkDefer( elem, type, "mark" ); @@ -49,13 +49,15 @@ jQuery.extend({ }, queue: function( elem, type, data ) { + var q; if ( elem ) { type = (type || "fx") + "queue"; - var q = jQuery.data( elem, type, undefined, true ); + q = jQuery._data( elem, type ); + // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !q || jQuery.isArray(data) ) { - q = jQuery.data( elem, type, jQuery.makeArray(data), true ); + q = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { q.push( data ); } @@ -68,8 +70,7 @@ jQuery.extend({ type = type || "fx"; var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - defer; + fn = queue.shift(); // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { @@ -84,7 +85,7 @@ jQuery.extend({ } fn.call(elem, function() { - jQuery.dequeue(elem, type); + jQuery.dequeue( elem, type ); }); } @@ -121,7 +122,7 @@ jQuery.fn.extend({ // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function() { |