There are two pointer exit events: mouseout
and mouseleave
.
The difference between the two is that mouseleave
fires only when the pointer leaves the watched element, while mouseout
fires when the pointer leaves the watched element or any of its children.
When you move the pointer in and out of an element, mouseleave
fires exactly once, while mouseout
may fire more than once, depending on the number of children you hovered over.
The question is: where is the mousein
equivalent of mouseout
? On MDN, only mouseleave
, mouseout
and mouseenter
are documented.
For a rare use case, I need to run code on every element that the pointer enters, including dynamically created ones. mousein
would solve this for me, but it does not seem to exist anymore.
The question is: where is the
mousein
equivalent ofmouseout
The corresponding event to mouseout
is mouseover
, and for mouseleave
it is mouseenter
.
Their main difference is that that mouseleave
/mouseenter
does not bubble, which is well explained in e.g. MDN, but in short
mouseleave
is fired when the pointer has exited the element and all of its descendants, whereas mouseout
is fired when the pointer leaves the element or leaves one of the element's descendants (even if the pointer is still within the element).
mouseover
, it differs from mouseenter
in that it doesn't bubble and that it isn't sent when the pointer is moved from one of its descendants' physical space to its own physical space.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments