Skip to content

Commit a1b708b

Browse files
dgrahamkeithamus
andcommitted
Replace continue with if statements
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
1 parent e34a50f commit a1b708b

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/bind.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,11 @@ function handleEvent(event: Event) {
6363
const el = event.currentTarget
6464
if (!(el instanceof Element)) return
6565
for (const binding of bindings(el)) {
66-
// Dispatch only to Catalyst elements.
67-
if (event.type !== binding.type || !controllers.has(binding.tag)) continue
68-
const controller = el.closest(binding.tag) as Element & Record<string, (ev: Event) => unknown>
69-
if (!controller) continue
70-
if (typeof controller[binding.method] === 'function') {
71-
controller[binding.method](event)
66+
if (event.type === binding.type && controllers.has(binding.tag)) {
67+
const controller = el.closest(binding.tag) as Element & Record<string, (ev: Event) => unknown>
68+
if (controller && typeof controller[binding.method] === 'function') {
69+
controller[binding.method](event)
70+
}
7271
}
7372
}
7473
}

0 commit comments

Comments
 (0)