MDN wants to talk to developers like you: https://qsurvey.mozilla.com/s3/8d22564490d8

UIEvent

翻譯不完整。請協助 翻譯此英文文件

UIEvent 介面是使用者介面的事件的基本型態。

UIEvent 是從 Event 衍伸過來。 雖然為了相容性,仍留著 UIEvent.initUIEvent() 方法,建立 UIEvent 物件最好是選擇以 UIEvent() constructor 建立。

許多介面直接或間接繼承此介面,例如:MouseEventTouchEventFocusEventKeyboardEventWheelEventInputEventCompositionEvent

建構式

UIEvent()
建立一個 UIEvent 物件 。

屬性

此介面亦繼承其父-- Event 的屬性:

UIEvent.cancelBubble
Is a Boolean indicating whether the bubbling of the event has been canceled or not.
UIEvent.detailRead only
Returns a long with details about the event, depending on the event type.
UIEvent.isChar Read only
Returns a Boolean indicating whether the event produced a key character or not.
UIEvent.layerX Read only
Returns the horizontal coordinate of the event relative to the current layer.
UIEvent.layerY Read only
Returns the vertical coordinate of the event relative to the current layer.
UIEvent.pageX Read only
Returns the horizontal coordinate of the event relative to the whole document.
UIEvent.pageY Read only
Returns the vertical coordinate of the event relative to the whole document.
UIEvent.sourceCapabilities Read only
Returns an instance of the InputDeviceCapabilities interface which provides information about the physical device responsible for generating a touch event.
UIEvent.viewRead only
Returns a WindowProxy that contains the view that generated the event.
UIEvent.which Read only
Returns the numeric keyCode of the key pressed, or the character code (charCode) for an alphanumeric key pressed.

方法

此介面亦繼承其父-- Event 的方法:

UIEvent.initUIEvent()
初始化 UIEvent 物件。若該事件已經觸發的話,此方法就不會執行任何東西。

規範

Specification Status Comment
InputDeviceCapabilities Editor's Draft Added sourceCapabilities property.
Document Object Model (DOM) Level 3 Events Specification
The definition of 'UIEvent' in that specification.
Working Draft 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.
Recommendation Initial definition

瀏覽器相容性

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) (Yes)[2] ? (Yes) ?
UIEvent() (Yes) (Yes) 11 (11) ? (Yes) ?
cancelBubble defined on Event ? (Yes) 53 (53)[1] ? ? ?
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes)[2] ? (Yes) ?
UIEvent() (Yes) (Yes) 11.0 (11) ? (Yes) ?
cancelBubble defined on Event ? (Yes) 53.0 (53)[1] ? ? ?

[1] From Firefox 52, this property is now defined on the Event interface instead. See bug 1298970 for more details.

[2] The isChar property has never been supported by any browser but Firefox, and even on Firefox it's never worked except on Mac OSX. For that reason, it's been removed in Firefox 55 to align with other browsers.

參見

文件標籤與貢獻者

標籤: 
 此頁面的貢獻者: jackblackevo, Shiyou
 最近更新: jackblackevo,