mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fix #12149. Avoid memory leak on oldIE change events. Close gh-878.
This commit is contained in:
parent
9d07525a71
commit
ff7b7cfd1d
@ -130,3 +130,4 @@ Uri Gilad <antishok@gmail.com>
|
|||||||
Chris Faulkner <thefaulkner@gmail.com>
|
Chris Faulkner <thefaulkner@gmail.com>
|
||||||
Elijah Manor <elijah.manor@gmail.com>
|
Elijah Manor <elijah.manor@gmail.com>
|
||||||
Daniel Chatfield <chatfielddaniel@googlemail.com>
|
Daniel Chatfield <chatfielddaniel@googlemail.com>
|
||||||
|
Nikita Govorov <nikita.govorov@gmail.com>
|
@ -832,7 +832,7 @@ if ( !jQuery.support.changeBubbles ) {
|
|||||||
teardown: function() {
|
teardown: function() {
|
||||||
jQuery.event.remove( this, "._change" );
|
jQuery.event.remove( this, "._change" );
|
||||||
|
|
||||||
return rformElems.test( this.nodeName );
|
return !rformElems.test( this.nodeName );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -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() {
|
asyncTest("trigger click on checkbox, fires change event", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user