use capture phase

pull/10617/head
Simon Holthausen 2 years ago
parent b8b5655bdf
commit 4ff8995053

@ -54,7 +54,9 @@ export function listen_to_event_and_reset_event(element, event, handler, on_rese
if (!listening_to_form_reset) { if (!listening_to_form_reset) {
listening_to_form_reset = true; listening_to_form_reset = true;
document.addEventListener('reset', (evt) => { document.addEventListener(
'reset',
(evt) => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
if (!evt.defaultPrevented) { if (!evt.defaultPrevented) {
for (const e of /**@type {HTMLFormElement} */ (evt.target).elements) { for (const e of /**@type {HTMLFormElement} */ (evt.target).elements) {
@ -63,6 +65,9 @@ export function listen_to_event_and_reset_event(element, event, handler, on_rese
} }
} }
}); });
}); },
// In the capture phase to guarantee we get noticed of it (no possiblity of stopPropagation)
{ capture: true }
);
} }
} }

Loading…
Cancel
Save