Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Event: Prevent leverageNative from registering duplicate dummy handlers
Closes gh-4353
  • Loading branch information
gibson042 authored and mgol committed Apr 29, 2019
1 parent 24d71ac commit 6c1e7db
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/event.js
Expand Up @@ -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 );
Expand All @@ -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" );
}
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 6c1e7db

Please sign in to comment.