InputEvent

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

InputEvent interface represents an event notifying of editable content change.

构造函数

InputEvent()
创建 InputEvent 对象。

特性

This interface inherits properties from its parents, UIEvent and Event .

InputEvent.data 只读
返回 DOMString with the inserted characters. This may be an empty string if the change doesn't insert text (such as when deleting characters, for example).
InputEvent.dataTransfer 只读
返回 DataTransfer object containing information about richtext or plaintext data being added to or removed from editable content.
InputEvent.inputType 只读
Returns the type of change for editable content such as, for example, inserting, deleting, or formatting text. See the property page for a complete list of input types.
InputEvent.isComposing 只读
返回 Boolean value indicating if the event is fired after compositionstart and before compositionend .

方法

This interface inherits methods from its parents, UIEvent and Event .

InputEvent.getTargetRanges()
Returns an array of static ranges that will be affected by a change to the DOM if the input event is not canceled.

规范

规范 状态 Comment
Input Events Level 2
The definition of 'InputEvent' in that specification.
工作草案
UI Events
The definition of 'InputEvent' in that specification.
工作草案 初始定义。

浏览器兼容性

更新 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
InputEvent
Chrome 60 Edge 79 Firefox 31 IE No Opera 47 Safari 10.1 WebView Android 60 Chrome Android 60 Firefox Android 31 Opera Android 44 Safari iOS 10.3 Samsung Internet Android 8.0
InputEvent() 构造函数
Chrome 60 Edge 79 Firefox 31 IE No Opera 47 Safari ? WebView Android 60 Chrome Android 60 Firefox Android 31 Opera Android 44 Safari iOS ? Samsung Internet Android 8.0
data
Chrome 60 Edge 79 Firefox 67 IE No Opera 47 Safari No WebView Android 60 Chrome Android 60 Firefox Android 67 Opera Android 44 Safari iOS No Samsung Internet Android 8.0
dataTransfer
Chrome 60 Edge 79 Firefox 67 IE No Opera 47 Safari No WebView Android 60 Chrome Android 60 Firefox Android 67 Opera Android 44 Safari iOS No Samsung Internet Android 8.0
getTargetRanges
Chrome 60 Edge 79 Firefox No IE No Opera 47 Safari 10.1 WebView Android 60 Chrome Android 60 Firefox Android No Opera Android 44 Safari iOS 10.3 Samsung Internet Android 8.0
inputType
Chrome 60 Edge 79 Firefox 66 IE No Opera 47 Safari 10.1 WebView Android 60 Chrome Android 60 Firefox Android 66 Opera Android 44 Safari iOS 10.3 Samsung Internet Android 8.0
isComposing
Chrome 60 Edge 79 Firefox 31 IE No Opera 47 Safari No WebView Android 60 Chrome Android 60 Firefox Android 31 Opera Android 44 Safari iOS No Samsung Internet Android 8.0

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。

另请参阅