v148 · dom · removal
Deprecate and remove: non-allowlisted Event interfaces from document.createEvent()
Chrome 148 brings document.createEvent() into alignment with the DOM Standard by throwing NOT_SUPPORTED_ERR for any event interface that is not on the spec's allowlist. Code that passes unsupported interface strings will start seeing errors where it previously got a CustomEvent or a silent fallback.
document.createEvent("SomeNonStandardInterface") now throws. Migrate to new CustomEvent(), new Event(), or the appropriate constructor for the specific event type.
at a glance
| Shipped in | Chrome 148 |
|---|---|
| Status | In developer trial / enabled by default |
| Standards position | Spec-required change; other browsers already compliant |
| Spec | DOM Standard §document.createEvent() |
| Blink component | Blink>DOM |
| ChromeStatus | 5095987863486464 — Deprecate and remove: non-allowlisted Event interfaces |
why it exists
The DOM Standard explicitly lists which event interface names document.createEvent() must accept and requires NOT_SUPPORTED_ERR for everything else. Chrome historically accepted many non-standard strings for legacy compat, silently constructing a CustomEvent. This removal closes that compat gap, matches the behavior of Firefox and Safari, and removes a footgun where code that passes wrong interface names silently "worked" in Chrome but would fail cross-browser.
Interfaces with usage above 0.01% or those deemed difficult to remove immediately remain as deprecation-only (console warning) in this cycle.
Source: chromestatus summary + DOM Standard §3.6.the allowlist
The DOM Standard allows these event interface strings (case-insensitive):
| Allowed string | Creates |
|---|---|
"Event", "Events", "HTMLEvents" | Event |
"CustomEvent" | CustomEvent |
"UIEvent", "UIEvents" | UIEvent |
"MouseEvent", "MouseEvents" | MouseEvent |
"KeyboardEvent", "KeyboardEvents" | KeyboardEvent |
"TouchEvent" | TouchEvent (where supported) |
"FocusEvent" | FocusEvent |
"WheelEvent" | WheelEvent |
"InputEvent" | InputEvent |
"CompositionEvent" | CompositionEvent |
"MutationEvent", "MutationEvents" | MutationEvent (deprecated) |
All other strings now throw DOMException: NOT_SUPPORTED_ERR.
migration
The modern pattern uses constructors directly and doesn't need createEvent at all:
// Old — may throw in Chrome 148+
const evt = document.createEvent("SomeInterface");
evt.initEvent("click", true, true);
el.dispatchEvent(evt);
// New — use constructors
el.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true }));
el.dispatchEvent(new CustomEvent("my-event", { detail: { foo: "bar" } }));
el.dispatchEvent(new KeyboardEvent("keydown", { key: "Enter", bubbles: true }));
Checking whether your code is affected
// Search your codebase for createEvent calls with non-standard strings:
// grep -r 'createEvent' src/ | grep -v -i
// 'Event\|CustomEvent\|UIEvent\|MouseEvent\|KeyboardEvent\|FocusEvent\|WheelEvent\|InputEvent\|CompositionEvent'
browser support
| Chrome | 148 — throws for non-allowlisted strings |
|---|---|
| Firefox | Already spec-compliant |
| Safari | Already spec-compliant |