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
touchend
replaced withtouchstart
these will be handlers for different events, andstopImmediatePropagation
stops processing only the current event. Moreover, it is obvious thattouchstart
will happen earlier, so the example is not about that at all. - Alexey Ten