]> source.dussan.org Git - jquery.git/commitdiff
Fixed #1701 by passing through the arguments as suggested.
authorDavid Serduke <davidserduke@gmail.com>
Wed, 28 Nov 2007 22:23:40 +0000 (22:23 +0000)
committerDavid Serduke <davidserduke@gmail.com>
Wed, 28 Nov 2007 22:23:40 +0000 (22:23 +0000)
src/event.js
test/unit/event.js

index 6475cd925a289aad5ff95d16dac232ddcd7e814b..d4a899bdd96b30527fa9ef86f8d607ba8407a9f1 100644 (file)
@@ -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;
                });
        },
 
index 593c6dad85db64134640ef5f6f42f0d4055d6952..47da9b698ab0c718ff39e2990d3257bda990e56c 100644 (file)
@@ -172,7 +172,7 @@ 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--; },
@@ -180,7 +180,11 @@ test("toggle(Function, Function)", function() {
                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" );