mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(core): remove unused preventDefault on listener (#55879)
`wrapListener` was only invoked with `wrapWithPreventDefault` set to `false`. PR Close #55879
This commit is contained in:
committed by
Dylan Hunn
parent
76633847a2
commit
a0690fe19f
@@ -216,7 +216,7 @@ export function listenerInternal(
|
||||
(<any>existingListener).__ngLastListenerFn__ = listenerFn;
|
||||
processOutputs = false;
|
||||
} else {
|
||||
listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
|
||||
listenerFn = wrapListener(tNode, lView, context, listenerFn);
|
||||
const cleanupFn = renderer.listen(target as RElement, eventName, listenerFn);
|
||||
ngDevMode && ngDevMode.rendererAddEventListener++;
|
||||
|
||||
@@ -226,7 +226,7 @@ export function listenerInternal(
|
||||
} else {
|
||||
// Even if there is no native listener to add, we still need to wrap the listener so that OnPush
|
||||
// ancestors are marked dirty when an event occurs.
|
||||
listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
|
||||
listenerFn = wrapListener(tNode, lView, context, listenerFn);
|
||||
}
|
||||
|
||||
// subscribe to directive outputs
|
||||
@@ -292,7 +292,6 @@ function wrapListener(
|
||||
lView: LView<{} | null>,
|
||||
context: {} | null,
|
||||
listenerFn: (e?: any) => any,
|
||||
wrapWithPreventDefault: boolean,
|
||||
): EventListener {
|
||||
// Note: we are performing most of the work in the listener function itself
|
||||
// to optimize listener registration.
|
||||
@@ -319,10 +318,6 @@ function wrapListener(
|
||||
nextListenerFn = (<any>nextListenerFn).__ngNextListenerFn__;
|
||||
}
|
||||
|
||||
if (wrapWithPreventDefault && result === false) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user