Skip to content
Permalink
Browse files

Fixed #1701 by passing through the arguments as suggested.

  • Loading branch information
davids549 committed Nov 28, 2007
1 parent 5c6c993 commit 3ae5fbc16a60cf3f41a1c6166a65dd473e904eb1
Showing with 7 additions and 3 deletions.
  1. +1 −1 src/event.js
  2. +6 −2 test/unit/event.js
@@ -333,7 +333,7 @@ jQuery.fn.extend({
event.preventDefault();

// and execute the function
return args[this.lastToggle].apply( this, [event] ) || false;
return args[this.lastToggle].apply( this, arguments ) || false;
});
},

@@ -172,15 +172,19 @@ test("trigger(event, [data], [fn])", function() {
});

test("toggle(Function, Function)", function() {
expect(4);
expect(5);
var count = 0,
fn1 = function(e) { count++; },
fn2 = function(e) { count--; },
preventDefault = function(e) { e.preventDefault() },
link = $('#mark');
link.click(preventDefault).click().toggle(fn1, fn2).click().click().click().click().click();
ok( count == 1, "Check for toggle(fn, fn)" );


$("#firstp").toggle(function () {
equals(arguments.length, 4, "toggle correctly passes through additional triggered arguments, see #1701" )
}, function() {}).trigger("click", [ 1, 2, 3 ]);

var first = 0;
$("#simon1").one("click", function() {
ok( true, "Execute event only once" );

0 comments on commit 3ae5fbc

Please sign in to comment.
You can’t perform that action at this time.