From b442abacbb8464f0165059e8da734e3143d0721f Mon Sep 17 00:00:00 2001 From: Alex Padilla Date: Wed, 11 Jan 2017 15:19:30 -0700 Subject: [PATCH] Event: Trigger checkbox and radio click events identically Fixes gh-3423 Closes gh-3494 --- src/event.js | 10 ++++++---- src/manipulation.js | 6 +++--- src/serialize.js | 2 +- src/{manipulation => }/var/rcheckableType.js | 0 4 files changed, 10 insertions(+), 8 deletions(-) rename src/{manipulation => }/var/rcheckableType.js (100%) diff --git a/src/event.js b/src/event.js index ab2c63cd1..97431773c 100644 --- a/src/event.js +++ b/src/event.js @@ -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; } diff --git a/src/manipulation.js b/src/manipulation.js index 4f79f8998..cadd89a2e 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -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 ) { diff --git a/src/serialize.js b/src/serialize.js index 2e28ce1e0..4008093c5 100644 --- a/src/serialize.js +++ b/src/serialize.js @@ -1,6 +1,6 @@ define( [ "./core", - "./manipulation/var/rcheckableType", + "./var/rcheckableType", "./core/init", "./traversing", // filter "./attributes/prop" diff --git a/src/manipulation/var/rcheckableType.js b/src/var/rcheckableType.js similarity index 100% rename from src/manipulation/var/rcheckableType.js rename to src/var/rcheckableType.js