aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCorey Frang <gnarf@gnarf.net>2012-08-13 12:43:49 -0500
committerDave Methvin <dave.methvin@gmail.com>2012-08-19 21:48:52 -0400
commit3812f9436da09d9f31ca4a61a14cd70f3e8cbeaf (patch)
tree1a329599ac875e3aa9fdad1d47c81b64f3e7248f /src
parent6b9fde13444cc54fefc1a235a42ec41571522252 (diff)
downloadjquery-3812f9436da09d9f31ca4a61a14cd70f3e8cbeaf.tar.gz
jquery-3812f9436da09d9f31ca4a61a14cd70f3e8cbeaf.zip
Fix #12278. Promises on non-default queue wait until a dequeue is attempted on an empty queue. Close gh-893.
Diffstat (limited to 'src')
-rw-r--r--src/queue.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/queue.js b/src/queue.js
index d49b3dd68..d3a1136a6 100644
--- a/src/queue.js
+++ b/src/queue.js
@@ -22,6 +22,7 @@ jQuery.extend({
type = type || "fx";
var queue = jQuery.queue( elem, type ),
+ startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
@@ -31,6 +32,7 @@ jQuery.extend({
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
+ startLength--;
}
if ( fn ) {
@@ -45,7 +47,8 @@ jQuery.extend({
delete hooks.stop;
fn.call( elem, next, hooks );
}
- if ( !queue.length && hooks ) {
+
+ if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
@@ -131,7 +134,8 @@ jQuery.fn.extend({
type = type || "fx";
while( i-- ) {
- if ( (tmp = jQuery._data( elements[ i ], type + "queueHooks" )) && tmp.empty ) {
+ tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+ if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}