Skip to content

Commit a0690fe

Browse files
JeanMechedylhunn
authored andcommitted
refactor(core): remove unused preventDefault on listener (#55879)
`wrapListener` was only invoked with `wrapWithPreventDefault` set to `false`. PR Close #55879
1 parent 7663384 commit a0690fe

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

packages/core/src/render3/instructions/listener.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export function listenerInternal(
216216
(<any>existingListener).__ngLastListenerFn__ = listenerFn;
217217
processOutputs = false;
218218
} else {
219-
listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
219+
listenerFn = wrapListener(tNode, lView, context, listenerFn);
220220
const cleanupFn = renderer.listen(target as RElement, eventName, listenerFn);
221221
ngDevMode && ngDevMode.rendererAddEventListener++;
222222

@@ -226,7 +226,7 @@ export function listenerInternal(
226226
} else {
227227
// Even if there is no native listener to add, we still need to wrap the listener so that OnPush
228228
// ancestors are marked dirty when an event occurs.
229-
listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
229+
listenerFn = wrapListener(tNode, lView, context, listenerFn);
230230
}
231231

232232
// subscribe to directive outputs
@@ -292,7 +292,6 @@ function wrapListener(
292292
lView: LView<{} | null>,
293293
context: {} | null,
294294
listenerFn: (e?: any) => any,
295-
wrapWithPreventDefault: boolean,
296295
): EventListener {
297296
// Note: we are performing most of the work in the listener function itself
298297
// to optimize listener registration.
@@ -319,10 +318,6 @@ function wrapListener(
319318
nextListenerFn = (<any>nextListenerFn).__ngNextListenerFn__;
320319
}
321320

322-
if (wrapWithPreventDefault && result === false) {
323-
e.preventDefault();
324-
}
325-
326321
return result;
327322
};
328323
}

0 commit comments

Comments
 (0)