Skip to content

Commit eb6c0a7

Browse files
gibson042mgol
authored andcommitted
Event: Prevent leverageNative from registering duplicate dummy handlers
(cherry-picked from 6c1e7db) Closes gh-4353
1 parent ddfa837 commit eb6c0a7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/event.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,7 @@ jQuery.event = {
479479

480480
// Claim the first handler
481481
if ( rcheckableType.test( el.type ) &&
482-
el.click && nodeName( el, "input" ) &&
483-
dataPriv.get( el, "click" ) === undefined ) {
482+
el.click && nodeName( el, "input" ) ) {
484483

485484
// dataPriv.set( el, "click", ... )
486485
leverageNative( el, "click", returnTrue );
@@ -497,8 +496,7 @@ jQuery.event = {
497496

498497
// Force setup before triggering a click
499498
if ( rcheckableType.test( el.type ) &&
500-
el.click && nodeName( el, "input" ) &&
501-
dataPriv.get( el, "click" ) === undefined ) {
499+
el.click && nodeName( el, "input" ) ) {
502500

503501
leverageNative( el, "click" );
504502
}
@@ -539,7 +537,9 @@ function leverageNative( el, type, expectSync ) {
539537

540538
// Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
541539
if ( !expectSync ) {
542-
jQuery.event.add( el, type, returnTrue );
540+
if ( dataPriv.get( el, type ) === undefined ) {
541+
jQuery.event.add( el, type, returnTrue );
542+
}
543543
return;
544544
}
545545

0 commit comments

Comments
 (0)