CompositionEvent represents events that occur due to the user indirectly entering text.
The locale of current input method (for example, the keyboard layout locale if the composition is associated with IME). Read only.
Initializes the attributes of a composition event.
void initCompositionEvent( in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in views::AbstractView viewArg, in DOMString dataArg, in DOMString localeArg );
- The type of composition event; this will be one of
- Whether or not the event can bubble.
- Whether or not the event can be canceled.
windowobject from which the event was generated.
- The value of the
- The value of the
|Document Object Model (DOM) Level 3 Events Specification
The definition of 'CompositionEvent' in that specification.
|Feature||Chrome||Edge||Firefox (Gecko)||Internet Explorer||Opera||Safari|
|Basic support||(Yes)||(Yes)||9.0 (9.0)||(Yes)||No support||?|
|Feature||Android||Edge||Firefox Mobile (Gecko)||IE Mobile||Opera Mobile||Safari Mobile|
|Basic support||?||(Yes)||9.0 (9.0)||?||?||?|
compositionend events were fired in versions of Gecko before 9.0, but didn't have the DOM Level 3 attributes and methods. In addition, support for the
compositionupdate event was added in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6).
localeattribute for trusted events yet. However, web developers can set this value via
initCompositionEvent()when creating untrusted events.
Gecko's editors (for example,
<div contenteditable/>, and
designMode) start composition after the bubble phase of
compositionstart. So, by the time your
compositionstart handler is called, no contents have not been modified.
Gecko's editors don't handle the
compositionupdate event yet. By the time your
compositionupdate handler is called, no contents have been modified.
By the time your
compositionend event handler is called, composition is complete, and no further changes will occur. For that reason, if you call
event.stopPropagation() on the
compositionend event, you can break composition behavior and cause editors to fail to manage editing properly. See bug 697842 for progress on this problem getting fixed.