UIEvent
接口表示简单用户界面事件。
UIEvent
派生自
事件
。尽管
UIEvent.initUIEvent()
method is kept for backward compatibility, you should create a
UIEvent
对象使用
UIEvent()
构造函数。
Several interfaces are direct or indirect descendants of this one:
MouseEvent
,
TouchEvent
,
FocusEvent
,
KeyboardEvent
,
WheelEvent
,
InputEvent
,和
CompositionEvent
.
<div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="../API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="../API/UIEvent" target="_top"><rect x="116" y="1" width="75" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">UIEvent</text></a></svg></div>
a:hover text { fill: #0095DD; pointer-events: all;}
UIEvent()
UIEvent
对象。
此接口还继承其父级的特性,
事件
.
UIEvent.cancelBubble
布尔
indicating whether the bubbling of the event has been canceled or not.
UIEvent.detail
只读
long
with details about the event, depending on the event type.
UIEvent.isChar
只读
布尔
indicating whether the event produced a key character or not.
UIEvent.layerX
只读
Returns the horizontal coordinate of the event relative to the current layer.
UIEvent.layerY
只读
Returns the vertical coordinate of the event relative to the current layer.
UIEvent.pageX
只读
Returns the horizontal coordinate of the event relative to the whole document.
UIEvent.pageY
只读
Returns the vertical coordinate of the event relative to the whole document.
UIEvent.sourceCapabilities
只读
InputDeviceCapabilities
interface, which provides information about the physical device responsible for generating a touch event.
UIEvent.view
只读
WindowProxy
that contains the view that generated the event.
UIEvent.which
只读
keyCode
of the key pressed, or the character code (
charCode
) for an alphanumeric key pressed.
此接口还继承其父级的方法,
事件
.
UIEvent.initUIEvent()
UIEvent
object. If the event has already being dispatched, this method does nothing.
| 规范 | 状态 | 注释 |
|---|---|---|
| InputDeviceCapabilities | 草案 |
添加
sourceCapabilities
特性。
|
| UI Events | 工作草案 | 扩展 DOM3 |
|
DOM (文档对象模型) 3 级事件规范
在该规范中的 UIEvent 定义。 |
过时 |
添加
UIEvent()
constructor, deprecated the
initUIEvent()
method and changed the type of
view
from
AbstractView
to
WindowProxy
.
|
|
DOM (文档对象模型) 2 级事件规范
在该规范中的 UIEvent 定义。 |
过时 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
UIEvent
|
Chrome Yes | Edge 12 | Firefox Yes | IE Yes | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
UIEvent()
构造函数
|
Chrome Yes | Edge ≤18 | Firefox 11 | IE ? | Opera Yes | Safari ? | WebView Android Yes | Chrome Android Yes | Firefox Android 14 | Opera Android Yes | Safari iOS ? | Samsung Internet Android Yes |
cancelBubble
弃用
非标
|
Chrome Yes | Edge 12 | Firefox Yes | IE Yes | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
detail
|
Chrome Yes | Edge 12 | Firefox Yes |
IE
部分支持
9
|
Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
initUIEvent
弃用
非标
|
Chrome Yes | Edge 12 | Firefox Yes | IE ? | Opera Yes | Safari ? | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS ? | Samsung Internet Android Yes |
isChar
弃用
非标
|
Chrome No | Edge No |
Firefox
? — 55
|
IE No | Opera No | Safari No | WebView Android No | Chrome Android No |
Firefox Android
? — 55
|
Opera Android No | Safari iOS No | Samsung Internet Android No |
layerX
非标
|
Chrome Yes | Edge 12 | Firefox Yes | IE 9 | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
layerY
非标
|
Chrome Yes | Edge 12 | Firefox Yes | IE 9 | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
pageX
弃用
非标
|
Chrome
? — 44
|
Edge 12 | Firefox ? | IE 9 | Opera ? | Safari ? |
WebView Android
? — 44
|
Chrome Android
? — 44
|
Firefox Android ? | Opera Android ? | Safari iOS ? |
Samsung Internet Android
? — 4.0
|
pageY
弃用
非标
|
Chrome
? — 44
|
Edge 12 | Firefox ? | IE 9 | Opera ? | Safari ? |
WebView Android
? — 44
|
Chrome Android
? — 44
|
Firefox Android ? | Opera Android ? | Safari iOS ? |
Samsung Internet Android
? — 4.0
|
sourceCapabilities
|
Chrome 47 | Edge ≤79 | Firefox ? | IE ? | Opera Yes | Safari ? | WebView Android 47 | Chrome Android 47 | Firefox Android ? | Opera Android Yes | Safari iOS ? | Samsung Internet Android 5.0 |
view
|
Chrome Yes | Edge 12 | Firefox Yes | IE 9 | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
which
|
Chrome Yes | Edge ≤79 | Firefox Yes | IE ? | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
完整支持
部分支持
不支持
兼容性未知
实验。期望将来行为有所改变。
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
见实现注意事项。
UIEvent