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 2f1ddd450752b5ba2efadb3fdd7b9b13b67e851e
Showing with 12 additions and 2 deletions.
  1. +2 −2 src/event.js
  2. +10 −0 test/unit/event.js
@@ -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

This comment has been minimized.

Copy link
Member

replied Apr 11, 2012

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

This comment has been minimized.

Copy link
Member

replied Apr 16, 2012

Please sign in to comment.
You can’t perform that action at this time.