aboutsummaryrefslogtreecommitdiffstats
path: root/src/queue.js
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2011-04-12 01:09:35 +0200
committerjaubourg <j@ubourg.net>2011-04-12 01:09:35 +0200
commit2b70893928035d53f46575003197e4a1fa52a844 (patch)
treebcbeb33f3704b532d113f224ec9c4fb09fe501b7 /src/queue.js
parentf6f1cc77f402f0825898756e8c2100798918a61a (diff)
downloadjquery-2b70893928035d53f46575003197e4a1fa52a844.tar.gz
jquery-2b70893928035d53f46575003197e4a1fa52a844.zip
Bug fixes in queue.js: type in dequeue could be undefined which lead to a wrong data key, which would then have undesirable data left dangling on elements. Also adds missing semicolon in effects unit.
Diffstat (limited to 'src/queue.js')
-rw-r--r--src/queue.js19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/queue.js b/src/queue.js
index ab06ae924..ce2305426 100644
--- a/src/queue.js
+++ b/src/queue.js
@@ -7,7 +7,7 @@ function handleQueueMarkDefer( elem, type, src ) {
defer = jQuery.data( elem, deferDataKey, undefined, true );
if ( defer &&
( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
- ( src === "mark " || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
+ ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
// Give room for hard-coded callbacks to fire first
// and eventually mark/queue something else on the element
setTimeout( function() {
@@ -35,13 +35,10 @@ jQuery.extend({
elem = force;
force = false;
}
-
if ( elem ) {
type = type || "fx";
-
var key = type + "mark",
count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
-
if ( count ) {
jQuery.data( elem, key, count, true );
} else {
@@ -54,21 +51,22 @@ jQuery.extend({
queue: function( elem, type, data ) {
if ( elem ) {
type = (type || "fx") + "queue";
- var q = jQuery.data( elem, type, undefined, true ) || [];
-
+ var q = jQuery.data( elem, type, undefined, true );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
- if ( !q.length || jQuery.isArray(data) ) {
+ if ( !q || jQuery.isArray(data) ) {
q = jQuery.data( elem, type, jQuery.makeArray(data), true );
} else {
q.push( data );
}
}
- return q;
+ return q || [];
}
},
dequeue: function( elem, type ) {
+ type = type || "fx";
+
var queue = jQuery.queue( elem, type ),
fn = queue.shift(),
defer;
@@ -107,7 +105,7 @@ jQuery.fn.extend({
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
- return this.each(function( i ) {
+ return this.each(function() {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
@@ -120,7 +118,6 @@ jQuery.fn.extend({
jQuery.dequeue( this, type );
});
},
-
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
@@ -134,11 +131,9 @@ jQuery.fn.extend({
}, time );
});
},
-
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
-
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, object ) {