Event: Trigger checkbox and radio click events identically

Fixes gh-3423
Closes gh-3494
This commit is contained in:
Alex Padilla 2017-01-11 15:19:30 -07:00 committed by Richard Gibson
parent 3c89329cb2
commit b442abacbb
4 changed files with 10 additions and 8 deletions

View File

@ -3,12 +3,12 @@ define( [
"./var/document",
"./var/documentElement",
"./var/rnothtmlwhite",
"./var/rcheckableType",
"./var/slice",
"./data/var/dataPriv",
"./core/init",
"./selector"
], function( jQuery, document, documentElement, rnothtmlwhite, slice, dataPriv ) {
], function( jQuery, document, documentElement, rnothtmlwhite, rcheckableType, slice, dataPriv ) {
"use strict";
@ -474,9 +474,11 @@ jQuery.event = {
},
click: {
// For checkbox, fire native event so checked state will be right
// For checkable types, fire native event so checked state will be right
trigger: function() {
if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
if ( rcheckableType.test( this.type ) &&
this.click && jQuery.nodeName( this, "input" ) ) {
this.click();
return false;
}

View File

@ -2,8 +2,8 @@ define( [
"./core",
"./var/concat",
"./var/push",
"./var/rcheckableType",
"./core/access",
"./manipulation/var/rcheckableType",
"./manipulation/var/rtagName",
"./manipulation/var/rscriptType",
"./manipulation/wrapMap",
@ -21,8 +21,8 @@ define( [
"./traversing",
"./selector",
"./event"
], function( jQuery, concat, push, access,
rcheckableType, rtagName, rscriptType,
], function( jQuery, concat, push, rcheckableType,
access, rtagName, rscriptType,
wrapMap, getAll, setGlobalEval, buildFragment, support,
dataPriv, dataUser, acceptData, DOMEval ) {

View File

@ -1,6 +1,6 @@
define( [
"./core",
"./manipulation/var/rcheckableType",
"./var/rcheckableType",
"./core/init",
"./traversing", // filter
"./attributes/prop"