Object: Event
|
Availability |
|
|
Extended by |
CustomEvent, MessageEvent, MutationEvent, StorageEvent, UIEvent |
The Event object represents provides contextual information about an event that Event handlers can use, such as the originating element, what stage the event is currently in within the event system, and so forth.
The properties and methods exposed by Event are minimal, and provide the basic functionality required by events of all types. More specific event objects should be used to acquire context information specific to a certain event type.
For example, the MouseEvent object, which inherits from Event through the UIEvent object, supplies additional properties supplying information such as the MouseEvent.button, MouseEvent.screenX and MouseEvent.screenY for where the current mouse event took place.
Event constants
|
Constant |
Phase type |
Description |
Support level |
Availability |
|---|---|---|---|---|
|
1 |
CAPTURING_PHASE |
Indicates that the event is in the capturing phase. |
DOM 2 Events |
4.6 or later |
|
2 |
AT_TARGET |
Indicates that the event is in being handled by the target node. |
DOM 2 Events |
4.6 or later |
|
3 |
BUBBLING_PHASE |
Indicates that the event is in the bubbling phase. |
DOM 2 Style |
4.6 or later |
Event properties
|
Property name |
Type |
Description |
Status |
Support level |
Availability |
|---|---|---|---|---|---|
|
boolean |
When true, the event is a bubbling event. |
read only |
DOM 2 Events |
4.6. or later |
|
|
boolean |
When true, the action of the event can be cancelled using Event.preventDefault() . |
read only |
DOM 2 Events |
4.6. or later |
|
|
boolean |
When true, bubbling of the event is cancelled. |
writable |
Non-standard. |
4.6. or later |
|
|
EventTarget |
The node of the Document object that is currently handling the event. |
read only |
DOM 2 Events |
4.6. or later |
|
|
unsigned short |
The phase that the event is currently in, represented using an Event constant. |
read only |
DOM 2 Events |
4.6. or later |
|
|
EventTarget |
The target node to which the event was dispatched. |
read only |
DOM 2 Events |
4.6. or later |
|
|
unsigned long |
The time (in milliseconds since epoch) at which the event was created. |
read only |
DOM 2 Events |
4.6 or later |
|
|
DOMString |
The name of the event. |
read only |
DOM 2 Events |
4.6 or later |
Event methods
|
Method name |
Description |
Support level |
Availability |
|---|---|---|---|
|
Initializes the properties of an Event object. |
DOM 2 Events |
4.6 or later |
|
|
Cancels the event, preventing the default action from occurring. |
DOM 2 Events |
4.6 or later |
|
|
Prevents further propagation of this event during an event flow. |
DOM 2 Events |
4.6 or later |