diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2019-04-29 13:26:53 -0400 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-04-29 20:50:00 +0200 |
commit | eb6c0a7c97b1b3cf00144de12d945c9c569f935c (patch) | |
tree | f68ac7165025a2393dd975ef68b0b575fac4c157 /src | |
parent | ddfa83766478268391bc9da96683fc0d4973fcfe (diff) | |
download | jquery-eb6c0a7c97b1b3cf00144de12d945c9c569f935c.tar.gz jquery-eb6c0a7c97b1b3cf00144de12d945c9c569f935c.zip |
Event: Prevent leverageNative from registering duplicate dummy handlers
(cherry-picked from 6c1e7dbf7311ae7c0c31ba335fe216185047ae5f)
Closes gh-4353
Diffstat (limited to 'src')
-rw-r--r-- | src/event.js | 10 |
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; } |