MCPcopy Index your code
hub / github.com/angular/components / _getEventTarget

Function _getEventTarget

src/cdk/platform/features/shadow-dom.ts:59–70  ·  view source on GitHub ↗
(event: Event)

Source from the content-addressed store, hash-verified

57
58/** Gets the target of an event while accounting for Shadow DOM. */
59export function _getEventTarget<T extends EventTarget>(event: Event): T | null {
60 // If an event is bound outside the Shadow DOM, the `event.target` will point to the shadow root
61 // so we have to use `composedPath` instead. Note that `composedPath` can throw if it's called
62 // during event replay (see #33386).
63 // TODO(crisbeto): it seems like `preventDefault` throws during replay as well.
64 if (event.composedPath) {
65 try {
66 return event.composedPath()[0] as T | null;
67 } catch {}
68 }
69 return event.target as T | null;
70}

Callers 15

_getOverlayRefMethod · 0.90
MatTimepickerInputClass · 0.90
MatRippleLoaderClass · 0.90
RippleEventManagerClass · 0.90
listenerMethod · 0.90
onContainerClickMethod · 0.90
handlerMethod · 0.90
_updateOnScrollMethod · 0.90
handleScrollMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…