Skip to content
Permalink
Browse files
Added a next() shortcut for queues
  • Loading branch information
wycats committed Jul 12, 2009
1 parent 5b84c7c commit 89b4bc5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
@@ -92,7 +92,7 @@ jQuery.extend({
fn = queue[0];

if( fn !== undefined )
fn.call(elem);
fn.call(elem, function() { jQuery(elem).dequeue(type); });
}
});

@@ -157,4 +157,25 @@ test("queue() with other types",function() {

// Clean up
$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();
})

0 comments on commit 89b4bc5

Please sign in to comment.