for example, here's the code:
star = document.getElementById("imageStar"); star.addEventListener('touchend', function (event) { event.stopImmediatePropagation(); }, false); star.addEventListener("touchend", function (event) { alert("это не должно появиться!");} ); It works . First the first handler is executed.
event.stopImmediatePropagation(); and the second handler does not work, but if in the second handler you replace touchend with touchstart or click then event.stopImmediatePropagation (); will stop working and all handlers will be executed
touchendreplaced withtouchstartthese will be handlers for different events, andstopImmediatePropagationstops processing only the current event. Moreover, it is obvious thattouchstartwill happen earlier, so the example is not about that at all. - Alexey Ten