The CompositionEvent() constructor creates a new CompositionEvent object instance.


const myEvent = new CompositionEvent(typeArg [, CompositionEventInit])


Is a DOMString representing the name of the event.
CompositionEventInit Optional

A CompositionEventInit dictionary object, which can contain the following members:

Initializes the data attribute of the CompositionEvent object to the characters generated by the IME composition.

Note: The CompositionEventInit dictionary inherits from the UIEventInit dictionary, so can also accept members defined on there.


Specification Status Comment
Document Object Model (DOM) Level 3 Events Specification
The definition of 'CompositionEvent()' in that specification.
Obsolete Initial definition.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
CompositionEvent() constructorChrome Full support YesEdge Full support 12Firefox Full support 53IE Full support YesOpera No support NoSafari ? WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 53Opera Android ? Safari iOS ? Samsung Internet Android Full support Yes


Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

See also