mithril.js: Some events cannot be handled
Consider the following example:
function view(ctrl) {
return m('div', { ontransitionend : ctrl.transitionFinished.bind(ctrl) });
}
It will not work since mithril uses the older way to add events instead of addEventListener. I’m assuming this is for performance and compatibility reasons, but it does break the assumption that “on{eventname}” is how you register events for a given element.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 15 (15 by maintainers)
FYI, rewrite branch now uses
addEventListenerso it should support every event type including transitionend, etcI’ve also noticed issues with using
on{eventname}properties. For example, spec people decided thatonwheelproperty won’t be a thing (see 782835 & 768199), so in IEwheelevent can be bound only viaaddEventListener, and other browsers that do support it are basically not following the spec.It seems that in future there will be more and more events that can’t be bound via
on{eventname}properties, as spec bodies and browser developers apparently try to move away from it in favor ofaddEventListener.Does this warrant implementing an abstraction for
on{eventname}properties, which would useaddEventListenerin the background? Because seriously, we can’t be moving everything into configs…