data
Summary
Gets the text affected by the composition event.
Property of dom/CompositionEventdom/CompositionEvent
Syntax
Note: This property is read-only.
var compositionData = event.html/elements/data;
Return Value
Returns an object of type StringString
The text affected by the event. See the notes for event specific values.
Examples
function getCompEventText(e) {
//retrieve text for composition event
var compEventText = e.data;
return compEventText;
}
Notes
The value varies by the event type:
- For compositionstart - the text that was selected.
- For compositionupdate - the current text.
- For compositionend - the text that will be committed.
If a user cancels a composition event, the data attribute is set to null on the final compositionupdate event.
Related specifications
- W3C HTML5
- Working Draft
- WHATWG HTML
- Living Standard
See also
Related pages
- TextEventTextEvent
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]