Event bubbling: When an event on an element is triggered, such as a mouse click on a button, the same event will be triggered in all ancestors of that element, a process known as event bubbling.
This event starts from the original ancestor and bubbles to the top of the DOM tree. (bug)
(I should have done it alone, but I did something wrong and you told my mom)
Simply put, bubbling is: The child element event is touched, and the same event of the parent box is touched.
Canceling bubbling is canceling this mechanism.
Block bubbling:
Firefox, Google, IE11:event.stopPropagation ();
IE10 below: Event.cancelbubble = true;
Compatible Code:
A.onclick = function (event) {
Stop bubbling
Event = Event | | window.event;
if (event && event.stoppropagation) {
Event.stoppropagation ();
}else{
Event.cancelbubble = true;
}
}
JavaScript event bubbling and canceling bubbling