Skip to content

Commit ccccb63

Browse files
dgrahamkeithamus
andcommitted
Assert event target is Element
The handleEvent function is bound only to Element targets. Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
1 parent a1b708b commit ccccb63

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/bind.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ function bindElements(root: Element) {
6060

6161
// Bind a single function to all events to avoid anonymous closure performance penalty.
6262
function handleEvent(event: Event) {
63-
const el = event.currentTarget
64-
if (!(el instanceof Element)) return
63+
const el = event.currentTarget as Element
6564
for (const binding of bindings(el)) {
6665
if (event.type === binding.type && controllers.has(binding.tag)) {
6766
const controller = el.closest(binding.tag) as Element & Record<string, (ev: Event) => unknown>

0 commit comments

Comments
 (0)