← Back to release summary

Add onbeforeinput global event handler content attribute

Category
DOM
Type
No developer-visible change
Status
Enabled by default (Chrome 105)
Intent stage
Prepare to ship

Summary

The 'beforeinput' event fires when the value of an <input>, <textarea>, or contenteditable element is about to be modified. Add an 'onbeforeinput' global content attribute to make it easier for developers to use.

Motivation

The 'beforeinput' event can already be utilized via addEventListener('beforeinput',...). This change makes it easier to use via element.onbeforeinput = .... It also allows testing for 'beforeinput' browser support via `document.documentElement.onbeforeinput === null`.

Standards & signals

Explainers: https://github.com/whatwg/html/pull/7992

View on chromestatus.com