Home

stopImmediatePropagation

stopImmediatePropagation is a method on Event objects in web browsers. When invoked from an event listener, it immediately stops the event from continuing to propagate and also prevents any remaining listeners on the same target for that event from being called. In practice, after the call the event will not bubble up to ancestor elements, and other listeners registered on the current element for the same event type will not run.

This behavior differs from stopPropagation, which halts propagation to ancestor elements but may still allow other

Important to note is that stopImmediatePropagation does not by itself prevent the browser’s default action for

Usage considerations include the potential to disrupt other scripts or libraries that rely on event listeners

Compatibility is broad across modern browsers; it is supported in Chrome, Firefox, Safari, Edge, and IE9 and

listeners
on
the
same
target
to
execute.
stopImmediatePropagation
combines
both
effects
by
stopping
propagation
and
skipping
the
rest
of
the
current
target’s
listeners
for
the
event.
It
is
therefore
possible
for
some
handlers
to
have
run
before
the
call,
and
for
none
of
the
remaining
ones
on
the
same
target
to
run
afterward.
the
event.
If
the
desired
outcome
includes
stopping
the
default
behavior
(such
as
submitting
a
form),
preventDefault
must
be
called
separately
within
the
handler.
on
the
same
element.
It
is
commonly
used
when
a
handler
needs
to
take
exclusive
control
over
an
event
flow,
but
should
be
used
sparingly
due
to
possible
side
effects
on
multiple
components
listening
for
the
same
event.
later.