]> source.dussan.org Git - jquery.git/commitdiff
Event: Prevent leverageNative from registering duplicate dummy handlers
authorRichard Gibson <richard.gibson@gmail.com>
Mon, 29 Apr 2019 17:26:53 +0000 (13:26 -0400)
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Mon, 29 Apr 2019 18:50:00 +0000 (20:50 +0200)
(cherry-picked from 6c1e7dbf7311ae7c0c31ba335fe216185047ae5f)

Closes gh-4353

src/event.js

index 48d9095c9f8653a488d8721c79b8b8a16c8a2cbe..3ff11ad0be76da90c9c9c90351e02706aa6d454a 100644 (file)
@@ -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;
        }