mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Fix #11500. Allow triggered, simulated change events.
This commit is contained in:
parent
62a4c84503
commit
2f1ddd4507
@ -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 );
|
||||
|
||||
|
@ -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");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user