The UIEvent interface represents simple user interface events.
UIEvent derives from Event. Although the UIEvent.initUIEvent() method is kept for backward compatibility, you should create a UIEvent object using the UIEvent() constructor.
Several interfaces are direct or indirect descendants of this one: MouseEvent, TouchEvent, FocusEvent, KeyboardEvent, WheelEvent, InputEvent, and CompositionEvent.
UIEvent()UIEvent object.This interface also inherits properties of its parent, Event.
UIEvent.cancelBubble
Boolean indicating whether the bubbling of the event has been canceled or not.UIEvent.detailRead only
long with details about the event, depending on the event type.UIEvent.isChar Read only
Boolean indicating whether the event produced a key character or not.UIEvent.layerX Read only
UIEvent.layerY Read only
UIEvent.pageX Read only
UIEvent.pageY Read only
UIEvent.sourceCapabilities Read only
UIEvent.viewRead only
WindowProxy that contains the view that generated the event.UIEvent.which Read only keyCode of the key pressed, or the character code (charCode) for an alphanumeric key pressed.This interface also inherits methods of its parent, Event.
UIEvent.initUIEvent()
UIEvent object. If the event has already being dispatched, this method does nothing.| Specification | Status | Comment |
|---|---|---|
| InputDeviceCapabilities | Draft | Added sourceCapabilities property. |
| UI Events | Working Draft | Extend DOM3 |
| Document Object Model (DOM) Level 3 Events Specification The definition of 'UIEvent' in that specification. | Obsolete | Added the UIEvent() constructor, deprecated the initUIEvent() method and changed the type of view from AbstractView to WindowProxy. |
| Document Object Model (DOM) Level 2 Events Specification The definition of 'UIEvent' in that specification. | Obsolete | Initial definition |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | Yes | Yes | Yes | ? | Yes | ? |
UIEvent() constructor |
Yes | Yes | 11 | ? | Yes | ? |
cancelBubble
|
Yes | Yes | Yes | Yes | Yes | Yes |
detail |
Yes | Yes | Yes | 9 | Yes | Yes |
initUIEvent
|
Yes | Yes | Yes | ? | Yes | ? |
isChar
|
No | No | ? — 55
|
No | No | No |
layerX
|
Yes | Yes | Yes | 9 | Yes | Yes |
layerY
|
Yes | Yes | Yes | 9 | Yes | Yes |
pageX
|
? — 44
|
? | ? | 9 | ? | ? |
pageY
|
? — 44
|
? | ? | 9 | ? | ? |
sourceCapabilities
|
47 | ? | ? | ? | ? | ? |
view |
Yes | Yes | Yes | 9 | Yes | Yes |
which |
? | ? | ? | ? | ? | ? |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes | Yes | Yes | Yes | Yes | ? | ? |
UIEvent() constructor |
Yes | Yes | Yes | 14 | Yes | ? | ? |
cancelBubble
|
Yes | Yes | Yes | Yes | Yes | Yes | ? |
detail |
Yes | Yes | Yes | Yes | Yes | Yes | ? |
initUIEvent
|
Yes | Yes | Yes | Yes | Yes | ? | ? |
isChar
|
No | No | No | ? — 55
|
No | No | No |
layerX
|
Yes | Yes | Yes | Yes | Yes | Yes | ? |
layerY
|
Yes | Yes | Yes | Yes | Yes | Yes | ? |
pageX
|
? — 44
|
? — 44
|
? | ? | ? | ? | ? |
pageY
|
? — 44
|
? — 44
|
? | ? | ? | ? | ? |
sourceCapabilities
|
47 | 47 | ? | ? | ? | ? | ? |
view |
Yes | Yes | Yes | Yes | Yes | Yes | ? |
which |
? | ? | ? | ? | ? | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/UIEvent