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)

Most upvoted comments

FYI, rewrite branch now uses addEventListener so it should support every event type including transitionend, etc

I’ve also noticed issues with using on{eventname} properties. For example, spec people decided that onwheel property won’t be a thing (see 782835 & 768199), so in IE wheel event can be bound only via addEventListener, 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 of addEventListener.

Does this warrant implementing an abstraction for on{eventname} properties, which would use addEventListener in the background? Because seriously, we can’t be moving everything into configs…