May 2017
Intermediate to advanced
448 pages
10h 10m
English
Event bubbling can cause unexpected behavior, especially when the wrong element responds to a mouseover or mouseout event. Consider a mouseout event handler attached to the <div> element in our example. When the user's mouse cursor exits the <div> element, the mouseout handler is run as anticipated. Since this is at the top of the hierarchy, no other elements get the event. On the other hand, when the cursor exits the <a> element, a mouseout event is sent to that. This event will then bubble up to the <span> element and then to the <div> element, firing the same event handler. This bubbling sequence is unlikely to be desired.
The mouseenter and mouseleave events, either bound individually or combined in the ...
Read now
Unlock full access