Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 gh-5459 Ref gh-5236
- Loading branch information