Skip to content

events: allow dispatch many times without listener

This fixes an issue where the fast path of EventTarget's hybrid dispatch (for when there aren't any listeners attached) didn't reset the kIsBeingDispatchedFlag, meaning an event couldn't be dispatched multiple times:

const target = new EventTarget();
const event = new Event("test");
target.dispatchEvent(event);
target.dispatchEvent(event); // Uncaught Error [ERR_EVENT_RECURSION]: The event "test" is already being dispatched

Merge request reports

Loading