Skip to content

Commit

Permalink
allow strings as event handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
benStre committed Jul 1, 2024
1 parent cce7815 commit 8f142ba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion datex-bindings/dom-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,11 @@ export class DOMUtils {
if (!(<DOMUtils.elWithUIXAttributes>element)[DOMUtils.EVENT_LISTENERS].has(eventName)) (<DOMUtils.elWithUIXAttributes>element)[DOMUtils.EVENT_LISTENERS].set(eventName, new Set());
(<DOMUtils.elWithUIXAttributes>element)[DOMUtils.EVENT_LISTENERS].get(eventName)!.add([handler, false]);
}
else throw new Error("Cannot set event listener for element attribute '"+attr+"'")
else if (typeof handler == "string") element.setAttribute(attr, handler);
else {
console.log(attr,handler)
throw new Error("Cannot set event listener for element attribute '"+attr+"'")
}
}

}
Expand Down

0 comments on commit 8f142ba

Please sign in to comment.