aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2019-04-29 13:26:53 -0400
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-04-29 19:26:53 +0200
commit6c1e7dbf7311ae7c0c31ba335fe216185047ae5f (patch)
tree4419ca7c2d95b5117f8b8a03771bd2478834e653
parent24d71ac70406f522fc1b09bf7c4025251ec3aee6 (diff)
downloadjquery-6c1e7dbf7311ae7c0c31ba335fe216185047ae5f.tar.gz
jquery-6c1e7dbf7311ae7c0c31ba335fe216185047ae5f.zip
Event: Prevent leverageNative from registering duplicate dummy handlers
Closes gh-4353
-rw-r--r--src/event.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/event.js b/src/event.js
index 48d9095c9..3ff11ad0b 100644
--- a/src/event.js
+++ b/src/event.js
@@ -479,8 +479,7 @@ jQuery.event = {
// Claim the first handler
if ( rcheckableType.test( el.type ) &&
- el.click && nodeName( el, "input" ) &&
- dataPriv.get( el, "click" ) === undefined ) {
+ el.click && nodeName( el, "input" ) ) {
// dataPriv.set( el, "click", ... )
leverageNative( el, "click", returnTrue );
@@ -497,8 +496,7 @@ jQuery.event = {
// Force setup before triggering a click
if ( rcheckableType.test( el.type ) &&
- el.click && nodeName( el, "input" ) &&
- dataPriv.get( el, "click" ) === undefined ) {
+ el.click && nodeName( el, "input" ) ) {
leverageNative( el, "click" );
}
@@ -539,7 +537,9 @@ function leverageNative( el, type, expectSync ) {
// Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
if ( !expectSync ) {
- jQuery.event.add( el, type, returnTrue );
+ if ( dataPriv.get( el, type ) === undefined ) {
+ jQuery.event.add( el, type, returnTrue );
+ }
return;
}