Commit efb6e46
committed
Event: Increase robustness of an inner native event in leverageNative
In Firefox, alert displayed just before blurring an element dispatches
the native blur event twice which tripped the jQuery logic if a jQuery blur
handler was not attached before the trigger call.
This was because the `leverageNative` logic part for triggering first checks if
setup was done before (which, for example, is done if a jQuery handler was
registered before for this element+event pair) and - if it was not - adds
a dummy handler that just returns `true`. The `leverageNative` logic makes that
`true` then saved into private data, replacing the previous `saved` array. Since
`true` passes the truthy check, the second native inner handler treated `true`
as an array, crashing on the `slice` call.
Since it's impossible to call `alert()` in unit tests, simulate the issue by
replacing the `addEventListener` method on a test button with a version that
calls attached blur handlers twice.
Fixes jquerygh-5459
Ref jquerygh-52361 parent 284b082 commit efb6e46
2 files changed
+35
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | 550 | | |
554 | 551 | | |
555 | 552 | | |
556 | 553 | | |
557 | 554 | | |
558 | 555 | | |
559 | | - | |
| 556 | + | |
560 | 557 | | |
561 | 558 | | |
562 | 559 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3493 | 3493 | | |
3494 | 3494 | | |
3495 | 3495 | | |
| 3496 | + | |
| 3497 | + | |
| 3498 | + | |
| 3499 | + | |
| 3500 | + | |
| 3501 | + | |
| 3502 | + | |
| 3503 | + | |
| 3504 | + | |
| 3505 | + | |
| 3506 | + | |
| 3507 | + | |
| 3508 | + | |
| 3509 | + | |
| 3510 | + | |
| 3511 | + | |
| 3512 | + | |
| 3513 | + | |
| 3514 | + | |
| 3515 | + | |
| 3516 | + | |
| 3517 | + | |
| 3518 | + | |
| 3519 | + | |
| 3520 | + | |
| 3521 | + | |
| 3522 | + | |
| 3523 | + | |
| 3524 | + | |
| 3525 | + | |
| 3526 | + | |
| 3527 | + | |
| 3528 | + | |
| 3529 | + | |
3496 | 3530 | | |
3497 | 3531 | | |
3498 | 3532 | | |
| |||
0 commit comments