]> 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 17:26:53 +0000 (19:26 +0200)
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;
        }