aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS.txt1
-rw-r--r--src/event.js2
-rw-r--r--test/unit/event.js23
3 files changed, 25 insertions, 1 deletions
diff --git a/AUTHORS.txt b/AUTHORS.txt
index 51200abaf..01c8d76b0 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -130,3 +130,4 @@ Uri Gilad <antishok@gmail.com>
Chris Faulkner <thefaulkner@gmail.com>
Elijah Manor <elijah.manor@gmail.com>
Daniel Chatfield <chatfielddaniel@googlemail.com>
+Nikita Govorov <nikita.govorov@gmail.com> \ 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( "<input type='text' id='change-ie-leak' />" ).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);