Constructor
new module:ct-dom /event /Event()
This constructor is private and should not be used. To create a normalised event please use the
module:ct-dom/event/Event#getNormalizedEvent
method.
Members
(static) Mouse Buttons .LEFT :int
The event corresponds to the left mouse button (value 0
).
Type:
- int
(static) Mouse Buttons .MIDDLE :int
The event corresponds to the middle mouse button (value 1
).
Type:
- int
(static) Mouse Buttons .RIGHT :int
The event corresponds to the right mouse button (value 2
).
Type:
- int
alt Key :boolean
Returns true
if the "ALT" key was pressed when the event was triggered, otherwise false
.
Type:
- boolean
button :int
Returns which mouse button was clicked when the event was triggered. Please see
module:ct-dom/event/Event/MouseButtons
for the possible values.
WARNING - The normalisation of the button in Internet Explorer is not suitable if the user is
expected to press more than one mouse button at any one time. If they do so, then the normalised value
will only indicate that one of the buttons has been pressed. For example if the user presses the LEFT
and RIGHT mouse buttons, this value will be Event.MouseButtons.LEFT
.
Type:
- int
char Code :int
Returns the ascii code of the character that will be inserted due to a keypress event.
Type:
- int
client X :int
Returns the horizontal coordinate of the mouse pointer when the event was triggered.
Type:
- int
client Y :int
Returns the vertical coordinate of the mouse pointer when the event was triggered.
Type:
- int
ctrl Key :boolean
Returns true
if the "CTRL" key was pressed when the event was triggered, otherwise
false
.
Type:
- boolean
key Code :int
Returns the code of the key during a keyUp or keyDown event. You should use this on keyUp or keyDown events. It contains a code indicating the hardware key that was pressed. This is not necessarily the same as the ascii character that will be inserted.
Type:
- int
related Target :Html Element
Returns the element related to the actual target that triggered the event. For example when a
mouseout
event is fired, the module:ct-dom/event/Event#target
will refer to
element that the mouse pointer is moving out of, whilst the relatedTarget
will refer to
the element that is being moved into.
Type:
-
Html
Element
screen X :int
Returns the horizontal coordinate of the mouse pointer when the event was triggered.
Type:
- int
screen Y :int
Returns the vertical coordinate of the mouse pointer when the event was triggered.
Type:
- int
shift Key :boolean
Returns true
if the "SHIFT" key was pressed when the event was triggered, otherwise
false
.
Type:
- boolean
target :Html Element
Returns the element that triggered the event. For example when a click
event is fired, this
is the element that was clicked.
Type:
-
Html
Element
type :String
Returns the name of the event.
Type:
- String
Methods
(static) cancel Event Bubbling(event Obj)
Crossbrowser method for canceling event bubbling.
Parameters:
Name | Type | Description |
---|---|---|
eventObj |
Object | The event object. |
(static) get Event Src(event Obj:) → {Object}
Crossbrowser method for returning the DOM element that fired the event.
Parameters:
Name | Type | Description |
---|---|---|
eventObj: |
Object | The event object |
Returns:
The DOM element where that fired the event
- Type
- Object
(static) get Normalized Event(raw Event) → {module:ct-dom /event /Event}
Gets the normalised event that applies across all browsers representing the specified event.
Parameters:
Name | Type | Description |
---|---|---|
rawEvent |
Html |
The event to be normalised. If this value is |
Throws:
-
if the rawEvent is
undefined
and thewindow.event
global does not exist. - Type
-
module:ct-core
/Error
Returns:
A normalised event.
finalize()
Clean up any DOM references in the event.
get Raw Event() → {HtmlEv ent}
Gets the underlying event that this normalised event was constructed from.
Returns:
The underlying event.
- Type
-
Html
Event
prevent Default()
Cancels the event if it is cancelable, without stopping further propagation of the event. This means that
any default action normally taken as a result of the event will not occur (e.g. the key that was pressed
will be ignored). This method does not stop further propagation of the event through the DOM (please see
module:ct-dom/event/Event#stopPropagation
).
Invoking this method for a non-cancelable event has no effect.
stop Propagation()
Prevents further propagation of the current event.