Fix #3827. Get the correct checkbox status for a click handler.

This commit is contained in:
Dave Methvin
2012-11-20 22:31:33 -05:00
parent 4fed8eb86d
commit 1fb2f92c35
3 changed files with 40 additions and 3 deletions

View File

@@ -263,7 +263,7 @@ jQuery.event = {
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
@@ -523,7 +523,15 @@ jQuery.event = {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( jQuery.nodeName( this, "input") && this.type === "checkbox" && this.click ) {
this.click();
return false;
}
}
},
focus: {
delegateType: "focusin"
},