question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mouseEnter/Leave event delegation broken w/o jQuery

See original GitHub issue

For 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:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rwjbluecommented, Aug 30, 2018

Would you mind opening a new issue to track that?

0reactions
amk221commented, Aug 30, 2018

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is jquery event delegation not working? - Stack Overflow
It means that #contain itself is not a static element, you should select closest static parent of the element. Otherwise jQuery doesn't ...
Read more >
.mouseenter() | jQuery API Documentation
mouseenter( handler )Returns: jQuery. Description: Bind an event handler to be fired when the mouse enters an element, or trigger that handler on...
Read more >
Event Delegation with jQuery - SitePoint
This article explores event delegation in jQuery. The article also compares event delegation to traditional event handling.
Read more >
Chrome fires jQuery mouseenter/leave events from bubbled ...
A workaround/hack for this is to check for and make an array of all forms/inputs in the document. Then on the mouseleave event...
Read more >
Moving the mouse: mouseover/out, mouseenter/leave
Events mouseover/mouseout, relatedTarget. The mouseover event occurs when a mouse pointer comes over an element, and mouseout – when it leaves.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found