Skip to content
Permalink
Browse files
Fix #11500. Allow triggered, simulated change events.
  • Loading branch information
rwaldron authored and dmethvin committed Apr 11, 2012
1 parent 62a4c84 commit 2f1ddd4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
@@ -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");
});

2 comments on commit 2f1ddd4

@Krinkle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test FAILED in Opera 11.1:

test 74: event: trigger click on checkbox, fires change event
assertion 1:  ok( true, "Change event fired as a result of triggered click" );

Expected 1 assertions, but 0 were run

Either the code in general is broken in Opera (unlikely), or it needs an async guard (stop(), start())

@Krinkle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.