choojs / choojs/nanohtml

change code to use `.addEventListener` instead?

Open
#103 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
688
Forks
48
PR merge metrics
No merged PRs in 30d

Description

When using addEventListener, one could pass an object `onclick=${{ handleEvent }}`.

This article explains it in more details what potential benefits this can have:
https://medium.com/@WebReflection/dom-handleevent-a-cross-platform-standard-since-year-2000-5bf17287fd38

I guess it would need only a single change here:
https://github.com/shama/bel/blob/68b261e6892170fb972f4488ab4dfc200b125213/browser.js#L76

`el[p] = val`
would become
`el.addEventListener(key.slice(2), val)`

---

I can make the PR if this change would be desirable.
If there are reasons why this would not be desirable, I'd be curious to learn about the reasons too :-)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.