Skip to content

Commit b442aba

Browse files
alexr101gibson042
authored andcommitted
Event: Trigger checkbox and radio click events identically
Fixes gh-3423 Closes gh-3494
1 parent 3c89329 commit b442aba

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/event.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ define( [
33
"./var/document",
44
"./var/documentElement",
55
"./var/rnothtmlwhite",
6+
"./var/rcheckableType",
67
"./var/slice",
78
"./data/var/dataPriv",
8-
99
"./core/init",
1010
"./selector"
11-
], function( jQuery, document, documentElement, rnothtmlwhite, slice, dataPriv ) {
11+
], function( jQuery, document, documentElement, rnothtmlwhite, rcheckableType, slice, dataPriv ) {
1212

1313
"use strict";
1414

@@ -474,9 +474,11 @@ jQuery.event = {
474474
},
475475
click: {
476476

477-
// For checkbox, fire native event so checked state will be right
477+
// For checkable types, fire native event so checked state will be right
478478
trigger: function() {
479-
if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
479+
if ( rcheckableType.test( this.type ) &&
480+
this.click && jQuery.nodeName( this, "input" ) ) {
481+
480482
this.click();
481483
return false;
482484
}

src/manipulation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ define( [
22
"./core",
33
"./var/concat",
44
"./var/push",
5+
"./var/rcheckableType",
56
"./core/access",
6-
"./manipulation/var/rcheckableType",
77
"./manipulation/var/rtagName",
88
"./manipulation/var/rscriptType",
99
"./manipulation/wrapMap",
@@ -21,8 +21,8 @@ define( [
2121
"./traversing",
2222
"./selector",
2323
"./event"
24-
], function( jQuery, concat, push, access,
25-
rcheckableType, rtagName, rscriptType,
24+
], function( jQuery, concat, push, rcheckableType,
25+
access, rtagName, rscriptType,
2626
wrapMap, getAll, setGlobalEval, buildFragment, support,
2727
dataPriv, dataUser, acceptData, DOMEval ) {
2828

src/serialize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
define( [
22
"./core",
3-
"./manipulation/var/rcheckableType",
3+
"./var/rcheckableType",
44
"./core/init",
55
"./traversing", // filter
66
"./attributes/prop"

0 commit comments

Comments
 (0)