mouseEnter/Leave event delegation broken w/o jQuery
See original GitHub issueFor components that have a mouseEnter()
(and/or mouseLeave()
) event handler, these are not called anymore when running without jQuery.
I think this is because those events don’t bubble, so event delegation based on the root element, which is what the EventDispatcher
is doing, does not work. Those events get only triggered for the element having the listener (the app’s rootElement
in this case). See https://developer.mozilla.org/en-US/docs/Web/Events/mouseenter
A possible workaround would be to use mouseover
under the hood, to enable event delegation, and to make sure it behaves the same as the mouseEnter
(i.e. doesn’t trigger again for child elements). jQuery seems to do the same, that’s why it works in jQuery mode: https://github.com/jquery/jquery/blob/899c56f6ada26821e8af12d9f35fa039100e838e/src/event.js#L666-L700
I could work on a PR, if we agree this ^ is the way forward!?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Would you mind opening a new issue to track that?
I’m experiencing some issues with this, here’s a demo repo https://github.com/amk221/-ember-jquery-mouse-events#example
[edit]: Issue: https://github.com/emberjs/ember.js/issues/16922