Calling stopProgagation() from within an event handler/listener will stop the capture and bubble event flow phases, but any events directly attached to the node or object will still be invoked. In the code below the onclick event attached to the
is never gets invoked because we are stopping the event from bubbling up the DOM when clicking on the.
Notice that other click events attached to the the
still get invoked! Additionally using stopPropagation() does not prevent default events. Had the
Calling the stopImmediatePropagation() from within an event handler/listener will stop the event flow phases (i.e. stopPropagation()), as well as any other like events attached to the event target that are attached after the event listener that invokes the stopImmediatePropagation() method. In the code example below If we call stopImmediatePropagation()from the second event listener attached to the
the click event that follows will not get invoked.