From: Oleg Gaidarenko Date: Fri, 13 Nov 2015 12:22:36 +0000 (+0300) Subject: Revert "Event: remove guard for falsy handler argument of jQuery#on method" X-Git-Tag: 2.2.0~46 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3cc496ceecdbd76b6c556e85b12696f7c4c09dd5;p=jquery.git Revert "Event: remove guard for falsy handler argument of jQuery#on method" This reverts commit fac67a984268ef8f7de952666fda6d8d32754f5f. --- diff --git a/src/event.js b/src/event.js index ddd92c5fc..280581249 100644 --- a/src/event.js +++ b/src/event.js @@ -70,6 +70,8 @@ function on( elem, types, selector, data, fn, one ) { } if ( fn === false ) { fn = returnFalse; + } else if ( !fn ) { + return this; } if ( one === 1 ) { @@ -654,7 +656,6 @@ jQuery.each( { } ); jQuery.fn.extend( { - on: function( types, selector, data, fn ) { return on( this, types, selector, data, fn ); }, diff --git a/test/unit/event.js b/test/unit/event.js index cdebbb4e7..b207441c9 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -6,7 +6,6 @@ QUnit.module( "event", { } ); QUnit.test( "on() with non-null,defined data", function( assert ) { - assert.expect( 2 ); var handler = function( event, data ) {