InputEvent
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年1月.
* Some parts of this feature may have varying levels of support.
InputEvent 接口表示通知用户可编辑内容更改的事件。
构造函数
InputEvent()-
创建一个
InputEvent对象。
实例属性
InputEvent.data只读-
返回包含插入字符的字符串,如果更改没有插入文本(例如删除字符时)则该值为空字符串。
InputEvent.dataTransfer只读-
返回一个
DataTransfer对象,该对象包含有关要添加到可编辑内容,或从可编辑内容中删除的富文本或纯文本数据的信息。 InputEvent.inputType只读-
返回对可编辑内容所做更改的类型,例如插入、删除或格式化文本。
InputEvent.isComposing只读-
返回一个
Boolean值,表明该事件是否在触发compositionstart事件之后且触发compositionend事件之前触发的。
实例方法
InputEvent.getTargetRanges()-
返回一个
StaticRange对象数组,如果不取消输入事件,该数组将受到 DOM 更改的影响。
规范
| Specification |
|---|
| Input Events Level 2> # interface-InputEvent> |
| UI Events> # interface-inputevent> |
浏览器兼容性
Loading…