mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(core): prevent invoking replay listeners on disconnected nodes (#60103)
This prevents replay from happening on nodes that have been removed from the DOM. fixes: #59841 PR Close #60103
This commit is contained in:
committed by
Miles Malerba
parent
a550c8c836
commit
0dbf693a4d
@@ -9,7 +9,7 @@
|
||||
// tslint:disable:no-duplicate-imports
|
||||
import {EventContract} from '@angular/core/primitives/event-dispatch';
|
||||
import {Attribute} from '@angular/core/primitives/event-dispatch';
|
||||
import {InjectionToken, Injector} from './di';
|
||||
import {InjectionToken} from './di';
|
||||
import {RElement} from './render3/interfaces/renderer_dom';
|
||||
|
||||
export const DEFER_BLOCK_SSR_ID_ATTRIBUTE = 'ngb';
|
||||
@@ -20,16 +20,6 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
export function invokeRegisteredDelegationListeners(event: Event) {
|
||||
const handlerFns = (event.currentTarget as Element)?.__jsaction_fns?.get(event.type);
|
||||
if (!handlerFns) {
|
||||
return;
|
||||
}
|
||||
for (const handler of handlerFns) {
|
||||
handler(event);
|
||||
}
|
||||
}
|
||||
|
||||
export function setJSActionAttributes(
|
||||
nativeElement: Element,
|
||||
eventTypes: string[],
|
||||
@@ -112,7 +102,7 @@ export const JSACTION_EVENT_CONTRACT = new InjectionToken<EventContractDetails>(
|
||||
|
||||
export function invokeListeners(event: Event, currentTarget: Element | null) {
|
||||
const handlerFns = currentTarget?.__jsaction_fns?.get(event.type);
|
||||
if (!handlerFns) {
|
||||
if (!handlerFns || !currentTarget?.isConnected) {
|
||||
return;
|
||||
}
|
||||
for (const handler of handlerFns) {
|
||||
|
||||
Reference in New Issue
Block a user