You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Fixesjquerygh-5459
Ref jquerygh-5236
0 commit comments