Fix #11500. Allow triggered, simulated change events.

This commit is contained in:
Rick Waldron 2012-04-10 21:54:07 -04:00 committed by Dave Methvin
parent 62a4c84503
commit 2f1ddd4507
2 changed files with 12 additions and 2 deletions

View File

@ -825,8 +825,9 @@ if ( !jQuery.support.changeBubbles ) {
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
jQuery.event.simulate( "change", this, event, true );
}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true );
});
}
return false;
@ -1073,4 +1074,3 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
});
})( jQuery );

View File

@ -2867,4 +2867,14 @@ test("fixHooks extensions", function() {
})();
test("trigger click on checkbox, fires change event", function() {
expect(1);
var check = jQuery("#check2");
check.on( "change", function() {
// get it?
check.off("change");
ok( true, "Change event fired as a result of triggered click" );
}).trigger("click");
});