(event: Event)
| 57 | |
| 58 | /** Gets the target of an event while accounting for Shadow DOM. */ |
| 59 | export 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 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…