data 只读特性在 CompositionEvent interface returns the characters generated by the input method that raised the event; its exact nature varies depending on the type of event that generated the CompositionEvent 对象。

句法

 myData = CompositionEvent.data
					

A DOMString representing the event data:

  • For compositionstart events, this is the currently selected text that will be replaced by the string being composed. This value doesn't change even if content changes the selection range; rather, it indicates the string that was selected when composition started.
  • For compositionupdate , this is the string as it stands currently as editing is ongoing.
  • For compositionend events, this is the string as committed to the editor.

规范

规范 状态 注释
DOM (文档对象模型) 3 级事件规范
The definition of 'data' in that specification.
过时 初始定义。

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
data Chrome Yes Edge 12 Firefox 9 IE Yes Opera No Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 9 Opera Android Yes Safari iOS Yes Samsung Internet Android Yes

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: