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.
This commit is contained in:
parent
f6f1cc77f4
commit
2b70893928
17
src/queue.js
17
src/queue.js
|
@ -35,13 +35,10 @@ jQuery.extend({
|
||||||
elem = force;
|
elem = force;
|
||||||
force = false;
|
force = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( elem ) {
|
if ( elem ) {
|
||||||
type = type || "fx";
|
type = type || "fx";
|
||||||
|
|
||||||
var key = type + "mark",
|
var key = type + "mark",
|
||||||
count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
|
count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
|
||||||
|
|
||||||
if ( count ) {
|
if ( count ) {
|
||||||
jQuery.data( elem, key, count, true );
|
jQuery.data( elem, key, count, true );
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,21 +51,22 @@ jQuery.extend({
|
||||||
queue: function( elem, type, data ) {
|
queue: function( elem, type, data ) {
|
||||||
if ( elem ) {
|
if ( elem ) {
|
||||||
type = (type || "fx") + "queue";
|
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
|
// Speed up dequeue by getting out quickly if this is just a lookup
|
||||||
if ( data ) {
|
if ( data ) {
|
||||||
if ( !q.length || jQuery.isArray(data) ) {
|
if ( !q || jQuery.isArray(data) ) {
|
||||||
q = jQuery.data( elem, type, jQuery.makeArray(data), true );
|
q = jQuery.data( elem, type, jQuery.makeArray(data), true );
|
||||||
} else {
|
} else {
|
||||||
q.push( data );
|
q.push( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return q;
|
return q || [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
dequeue: function( elem, type ) {
|
dequeue: function( elem, type ) {
|
||||||
|
type = type || "fx";
|
||||||
|
|
||||||
var queue = jQuery.queue( elem, type ),
|
var queue = jQuery.queue( elem, type ),
|
||||||
fn = queue.shift(),
|
fn = queue.shift(),
|
||||||
defer;
|
defer;
|
||||||
|
@ -107,7 +105,7 @@ jQuery.fn.extend({
|
||||||
if ( data === undefined ) {
|
if ( data === undefined ) {
|
||||||
return jQuery.queue( this[0], type );
|
return jQuery.queue( this[0], type );
|
||||||
}
|
}
|
||||||
return this.each(function( i ) {
|
return this.each(function() {
|
||||||
var queue = jQuery.queue( this, type, data );
|
var queue = jQuery.queue( this, type, data );
|
||||||
|
|
||||||
if ( type === "fx" && queue[0] !== "inprogress" ) {
|
if ( type === "fx" && queue[0] !== "inprogress" ) {
|
||||||
|
@ -120,7 +118,6 @@ jQuery.fn.extend({
|
||||||
jQuery.dequeue( this, type );
|
jQuery.dequeue( this, type );
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// Based off of the plugin by Clint Helfers, with permission.
|
// Based off of the plugin by Clint Helfers, with permission.
|
||||||
// http://blindsignals.com/index.php/2009/07/jquery-delay/
|
// http://blindsignals.com/index.php/2009/07/jquery-delay/
|
||||||
delay: function( time, type ) {
|
delay: function( time, type ) {
|
||||||
|
@ -134,11 +131,9 @@ jQuery.fn.extend({
|
||||||
}, time );
|
}, time );
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
clearQueue: function( type ) {
|
clearQueue: function( type ) {
|
||||||
return this.queue( type || "fx", [] );
|
return this.queue( type || "fx", [] );
|
||||||
},
|
},
|
||||||
|
|
||||||
// Get a promise resolved when queues of a certain type
|
// Get a promise resolved when queues of a certain type
|
||||||
// are emptied (fx is the type by default)
|
// are emptied (fx is the type by default)
|
||||||
promise: function( type, object ) {
|
promise: function( type, object ) {
|
||||||
|
|
2
test/unit/effects.js
vendored
2
test/unit/effects.js
vendored
|
@ -807,7 +807,7 @@ jQuery.checkState = function(){
|
||||||
jQuery.removeData(this, 'olddisplay', true);
|
jQuery.removeData(this, 'olddisplay', true);
|
||||||
|
|
||||||
start();
|
start();
|
||||||
}
|
};
|
||||||
|
|
||||||
// Chaining Tests
|
// Chaining Tests
|
||||||
test("Chain fadeOut fadeIn", function() {
|
test("Chain fadeOut fadeIn", function() {
|
||||||
|
|
Loading…
Reference in a new issue