mirror of
https://github.com/angular/angular.git
synced 2026-11-22 22:55:25 -05:00
Two issues caused browser test failures after the event replay fix: 1. `markEventHandledForElement` used the event object as a WeakMap key, but `DebugElement.triggerEventHandler` can pass null or primitive values as the event argument. Added an early return for non-object values. 2. Registering a separate `domListener` closure with `renderer.listen` instead of `wrappedListener` caused `DebugElement.triggerEventHandler` to invoke the handler twice: once via `this.listeners` (which holds `wrappedListener`) and once via Zone.js's `eventListeners` (which holds the unwrapped `domListener`). The existing dedup logic in `triggerEventHandler` checks if the unwrapped Zone.js listener is already in `invokedListeners`, but with two different function objects that check always fails. Replaced the `domListener` wrapper with a property (`__ngNativeEl__`) stored directly on `wrappedListener`. `wrapListenerIn_markDirtyAndPreventDefault` reads this property and calls `markEventHandledForElement` when the listener fires, while `renderer.listen` receives the same `wrappedListener` function that Angular stores in `lCleanup`, preserving the dedup invariant.
Angular
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT