CompositionEvent: CompositionEvent() constructor
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017.
The CompositionEvent() constructor creates a new CompositionEvent object.
Syntax
js
new CompositionEvent(type)
new CompositionEvent(type, options)
Parameters
type-
A string with the name of the event. It is case-sensitive and browsers set it to
compositionstart,compositionupdate, orcompositionend. optionsOptional-
An object that, in addition of the properties defined in
UIEvent(), has the following properties:dataOptional-
A string used to initialize the
dataproperty of the newCompositionEvent. Browser-generated events set it to the characters generated by the IME composition.
Return value
A new CompositionEvent object.
Specifications
| Specification |
|---|
| UI Events> # dom-compositionevent-compositionevent> |
Browser compatibility
Loading…
See also
CompositionEvent, the interface of the objects it constructs.