Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Pass correct arg list to special._default. Thanks @mikaelkaron!

  • Loading branch information...
commit df4a160be7fcc234a8e17eccb1c3fd02f231bcfc 1 parent 736d4d7
@dmethvin dmethvin authored
Showing with 6 additions and 6 deletions.
  1. +1 −1  src/event.js
  2. +5 −5 test/unit/event.js
View
2  src/event.js
@@ -365,7 +365,7 @@ jQuery.event = {
// If nobody prevented the default action, do it now
if ( !event.isDefaultPrevented() ) {
- if ( (!special._default || special._default.call( elem.ownerDocument, event, data ) === false) &&
+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
View
10 test/unit/event.js
@@ -1753,8 +1753,8 @@ test("live with special events", function() {
remove: function( handleObj ) {
ok( true, "Remove run." );
},
- _default: function( event ) {
- ok( true, "Default run." );
+ _default: function( event, arg ) {
+ ok( event.type === "foo" && arg == 42, "Default run with correct args." );
}
};
@@ -1769,16 +1769,16 @@ test("live with special events", function() {
});
// Run: Handler 1, Handler 2, Default
- jQuery("#liveSpan1").trigger("foo");
+ jQuery("#liveSpan1").trigger("foo", 42);
// Run: Handler 1, Default
- jQuery("#liveSpan1").trigger("foo.a");
+ jQuery("#liveSpan1").trigger("foo.a", 42);
// Run: remove
jQuery("#liveSpan1").die("foo.a");
// Run: Handler 2, Default
- jQuery("#liveSpan1").trigger("foo");
+ jQuery("#liveSpan1").trigger("foo", 42);
// Run: remove, teardown
jQuery("#liveSpan1").die("foo");
Please sign in to comment.
Something went wrong with that request. Please try again.