Skip to content

change code to use .addEventListener instead? #103

Open
@serapath

Description

@serapath

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 :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions