In hyperapp code base we could able to see the line:
https://github.com/hyperapp/hyperapp/blob/master/src/app.js#L135
which shows:
try {
element[name] = value
} catch (_) {}
Apparently, element
is an HTMLElement and value
is a function! The interesting part here is that, if name
is say for example onclick
and value
is a function which does prints something to the console, the above code correctly adds the event listener for onclick
.
I was wondering whether is this a short hand for addEventListener
or I'm wrong here?