Skip to content

Commit

Permalink
feature: allow false for listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
stagas committed Dec 28, 2022
1 parent 3ebc8cc commit e526e95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ export function updateProps(doc: Doc, el: Element, type: string, next: Props = {
if (isEvent(attr)) {
attr = toEvent(attr)
//!? 'updated event listener', attr, prev, value
el.removeEventListener(attr, prev, prev)
el.addEventListener(attr, value, value)
if (prev) el.removeEventListener(attr, prev, prev)
if (value) el.addEventListener(attr, value, value)
} else {
//!? 'updated function', attr, prev, value
props[attr] = (el as Any)[attr] = value
Expand Down

0 comments on commit e526e95

Please sign in to comment.