🔰capturing phase
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
handlers registered on container elements have the oppertunity to intercept events before they are delivered to their actual target.
// capturing handler, same as {capture: true}
container.addEventListener("click", capturingHandler, true);
// ⭐️ prevent touch screen default actions.
container.addEventListener("touchmove",
event => { event.preventDefault() },
{passive: false} // ⭐️ important
);
If you want to remove a capturing event handler, you must also pass true as the third argument to .
⚠️ 's capturing handlers are NOT invoked❗️
capturing handlers can be used:
for debugging
to
for handling mouse drags.