Commit 89b4bc53 authored by Yehuda Katz's avatar Yehuda Katz

Added a next() shortcut for queues

parent 5b84c7c4
...@@ -92,7 +92,7 @@ jQuery.extend({ ...@@ -92,7 +92,7 @@ jQuery.extend({
fn = queue[0]; fn = queue[0];
if( fn !== undefined ) if( fn !== undefined )
fn.call(elem); fn.call(elem, function() { jQuery(elem).dequeue(type); });
} }
}); });
......
...@@ -157,4 +157,25 @@ test("queue() with other types",function() { ...@@ -157,4 +157,25 @@ test("queue() with other types",function() {
// Clean up // Clean up
$div.removeData(); $div.removeData();
});
test("queue() passes in the next item in the queue as a parameter", function() {
expect(2);
var div = jQuery({});
var counter = 0;
div.queue("foo", function(next) {
equals(++counter, 1, "Dequeueing");
next();
}).queue("foo", function(next) {
equals(++counter, 2, "Next was called");
next();
}).queue("bar", function() {
equals(++counter, 3, "Other queues are not triggered by next()")
});
div.dequeue("foo");
div.removeData();
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment