Side navigation
#5884 closed bug (fixed)
Opened January 21, 2010 12:03AM UTC
Closed April 17, 2011 05:34PM UTC
live mouseenter/mouseleave events don't fire as expected when nested
Reported by: | oyejorge | Owned by: | brandon |
---|---|---|---|
Priority: | low | Milestone: | 1.6 |
Component: | event | Version: | 1.4 |
Keywords: | live mouseenter mouseleave | Cc: | |
Blocked by: | Blocking: |
Description
I found that when using the mouseenter/mouseleave events with the .live() method, the results were not the same as if I used the .bind() method.
When using the bind() method a nested mouseenter will not trigger the outer mouseleave. But when using live() the outer mouseleave will be triggered.
See attached test document.
Thanks for this amazing product!
I've also found this issue and narrowed it down - it only occurs when the parent and child elements have the events bound with the same selector.
Example:
Basically, the live event handler code in jQuery is only checking if the selectors are different instead of checking the parent/child relationship.
I've got a quick patch here:
http://github.com/gilmoreorless/jquery/commit/7774ed588fa04006cad2c729122816af6b019f2c
Cheers,
Gil