diff --git a/AUTHORS.txt b/AUTHORS.txt index 51200abaf..01c8d76b0 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -130,3 +130,4 @@ Uri Gilad Chris Faulkner Elijah Manor Daniel Chatfield +Nikita Govorov \ No newline at end of file diff --git a/src/event.js b/src/event.js index 2a2ea24aa..797f1aaee 100644 --- a/src/event.js +++ b/src/event.js @@ -832,7 +832,7 @@ if ( !jQuery.support.changeBubbles ) { teardown: function() { jQuery.event.remove( this, "._change" ); - return rformElems.test( this.nodeName ); + return !rformElems.test( this.nodeName ); } }; } diff --git a/test/unit/event.js b/test/unit/event.js index 16a9ff0fc..c1981623d 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2985,6 +2985,29 @@ if ( hasPHP ) { })(); +test("change handler should be detached from element", function() { + expect( 2 ); + + var $fixture = jQuery( "" ).appendTo( "body" ); + + var originRemoveEvent = jQuery.removeEvent; + + var wrapperRemoveEvent = function(elem, type, handle){ + equal("change", type, "Event handler for 'change' event should be removed"); + equal("change-ie-leak", jQuery(elem).attr("id"), "Event handler for 'change' event should be removed from appropriate element"); + originRemoveEvent(elem, type, handle); + }; + + jQuery.removeEvent = wrapperRemoveEvent ; + + $fixture.bind( "change", function( event ) {}); + $fixture.unbind( "change" ); + + $fixture.remove(); + + jQuery.removeEvent = originRemoveEvent; +}); + asyncTest("trigger click on checkbox, fires change event", function() { expect(1);