mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00: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. |
||
|---|---|---|
| .. | ||
| global | ||
| primitives | ||
| resources | ||
| rxjs-interop | ||
| schematics | ||
| src | ||
| test | ||
| testing | ||
| BUILD.bazel | ||
| index.ts | ||
| package.json | ||
| PACKAGE.md | ||
| public_api.ts | ||
| tsconfig-build.json | ||
| tsconfig-test.json | ||