CompositionEvent

The DOM CompositionEvent represents events that occur due to the user indirectly entering text.

构造函数

CompositionEvent()
创建新的 CompositionEvent object instance.

特性

This interface also inherits properties of its parent, UIEvent , and its ancestor — Event .

CompositionEvent.data 只读
Returns the characters generated by the input method that raised the event; its varies depending on the type of event that generated the CompositionEvent 对象。
CompositionEvent.locale 只读
Returns the locale of current input method (for example, the keyboard layout locale if the composition is associated with IME).

方法

This interface also inherits methods of its parent, UIEvent , and its ancestor — Event .

CompositionEvent.initCompositionEvent()
Initializes the attributes of a CompositionEvent 对象。

规范

规范 状态 Comment
UI Events
The definition of 'CompositionEvent' in that specification.
工作草案
Document Object Model (DOM) Level 3 Events Specification
The definition of 'CompositionEvent' in that specification.
Obsolete

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
CompositionEvent 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
CompositionEvent() 构造函数 Chrome Yes Edge 12 Firefox 53 IE Yes Opera No Safari ? WebView Android Yes Chrome Android Yes Firefox Android 53 Opera Android ? Safari iOS ? Samsung Internet Android Yes
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
initCompositionEvent
弃用 非标
Chrome Yes Edge 12 Firefox 9 IE Yes Opera No Safari ? WebView Android Yes Chrome Android Yes Firefox Android 9 Opera Android ? Safari iOS ? Samsung Internet Android Yes
locale
弃用 非标
Chrome Yes Edge 12 Firefox 9 IE Yes Opera No Safari ? WebView Android Yes Chrome Android Yes Firefox Android 9 Opera Android ? Safari iOS ? Samsung Internet Android Yes

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知
非标。预期跨浏览器支持较差。
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
弃用。不要用于新网站。

另请参阅