clearQueue and next should now work with default fx on all browsers
This commit is contained in:
parent
7cfec99858
commit
89dc1e0143
2 changed files with 11 additions and 28 deletions
|
@ -130,11 +130,11 @@ jQuery.fn.extend({
|
|||
if ( data === undefined )
|
||||
return jQuery.queue( this[0], type );
|
||||
|
||||
return this.each(function(){
|
||||
return this.each(function(i, elem){
|
||||
var queue = jQuery.queue( this, type, data );
|
||||
|
||||
if( type == "fx" && queue.length == 1 )
|
||||
queue[0].call(this);
|
||||
if( type == "fx" && queue.length == 1 )
|
||||
queue[0].call(this, function() { jQuery(elem).dequeue(type); });
|
||||
});
|
||||
},
|
||||
dequeue: function(type){
|
||||
|
@ -143,6 +143,6 @@ jQuery.fn.extend({
|
|||
});
|
||||
},
|
||||
clearQueue: function(type){
|
||||
return this.queue( type, [] );
|
||||
return this.queue( type || "fx", [] );
|
||||
}
|
||||
});
|
|
@ -180,22 +180,6 @@ test("queue(name) passes in the next item in the queue as a parameter", function
|
|||
div.removeData();
|
||||
});
|
||||
|
||||
expect(1);
|
||||
|
||||
var div = jQuery({});
|
||||
var counter = 0;
|
||||
|
||||
div.queue("foo", function(next) {
|
||||
counter++;
|
||||
jQuery(this).clearQueue("foo");
|
||||
next();
|
||||
}).queue("foo", function(next) {
|
||||
counter++;
|
||||
});
|
||||
|
||||
div.dequeue("foo");
|
||||
|
||||
equals(counter, 1, "the queue was cleared");
|
||||
test("queue(name) passes in the next item in the queue as a parameter", function() {
|
||||
expect(2);
|
||||
|
||||
|
@ -229,12 +213,10 @@ test("queue() passes in the next item in the queue as a parameter to fx queues",
|
|||
}).queue(function(next) {
|
||||
equals(++counter, 2, "Next was called");
|
||||
next();
|
||||
}).queue(function() {
|
||||
}).queue("bar", function() {
|
||||
equals(++counter, 3, "Other queues are not triggered by next()")
|
||||
});
|
||||
|
||||
div.dequeue();
|
||||
|
||||
div.removeData();
|
||||
});
|
||||
|
||||
|
@ -255,6 +237,8 @@ test("clearQueue(name) clears the queue", function() {
|
|||
div.dequeue("foo");
|
||||
|
||||
equals(counter, 1, "the queue was cleared");
|
||||
|
||||
div.removeData();
|
||||
});
|
||||
|
||||
test("clearQueue() clears the fx queue", function() {
|
||||
|
@ -265,13 +249,12 @@ test("clearQueue() clears the fx queue", function() {
|
|||
|
||||
div.queue(function(next) {
|
||||
counter++;
|
||||
jQuery(this).clearQueue();
|
||||
next();
|
||||
setTimeout(function() { jQuery(this).clearQueue(); next(); }, 50);
|
||||
}).queue(function(next) {
|
||||
counter++;
|
||||
});
|
||||
|
||||
div.dequeue();
|
||||
|
||||
equals(counter, 1, "the queue was cleared");
|
||||
})
|
||||
|
||||
div.removeData();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue