Class CKEDITOR.dom.event
Defined in: core/dom/event.js.
Constructor Attributes | Constructor Name and Description |
---|---|
CKEDITOR.dom.event(domEvent)
Represents a native DOM event object.
|
Field Attributes | Field Name and Description |
---|---|
The native DOM event object represented by this class instance.
|
Method Attributes | Method Name and Description |
---|---|
getKey()
Gets the key code associated to the event.
|
|
Gets a number represeting the combination of the keys pressed during the
event.
|
|
Retrieves the coordinates of the mouse pointer relative to the top-left
corner of the document, in mouse related event.
|
|
Returns the DOM node where the event was targeted to.
|
|
preventDefault(stopPropagation)
Prevents the original behavior of the event to happen.
|
|
Class Detail
CKEDITOR.dom.event(domEvent)
Since:
3.0
Represents a native DOM event object.
- Parameters:
- {Object} domEvent
- A native DOM event object.
Field Detail
{Object}
$
Since:
3.0
The native DOM event object represented by this class instance.
Method Detail
{Number}
getKey()
Since:
3.0
Gets the key code associated to the event.
alert( event.getKey() ); "65" is "a" has been pressed
- Returns:
- {Number} The key code.
{Number}
getKeystroke()
Since:
3.0
Gets a number represeting the combination of the keys pressed during the
event. It is the sum with the current key code and the CKEDITOR.CTRL,
CKEDITOR.SHIFT and CKEDITOR.ALT constants.
alert( event.getKeystroke() == 65 ); // "a" key alert( event.getKeystroke() == CKEDITOR.CTRL + 65 ); // CTRL + "a" key alert( event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65 ); // CTRL + SHIFT + "a" key
- Returns:
- {Number} The number representing the keys combination.
{Object}
getPageOffset()
Since:
3.0
Retrieves the coordinates of the mouse pointer relative to the top-left
corner of the document, in mouse related event.
element.on( 'mousemouse', function( ev ) { var pageOffset = ev.data.getPageOffset(); alert( pageOffset.x ); // page offset X alert( pageOffset.y ); // page offset Y });
- Returns:
- {Object} The object contains the position.
{CKEDITOR.dom.node}
getTarget()
Since:
3.0
Returns the DOM node where the event was targeted to.
var element = CKEDITOR.document.getById( 'myElement' ); element.on( 'click', function( ev ) { // The DOM event object is passed by the "data" property. var domEvent = ev.data; // Add a CSS class to the event target. domEvent.getTarget().addClass( 'clicked' ); });
- Returns:
- {CKEDITOR.dom.node} The target DOM node.
{Undefined}
preventDefault(stopPropagation)
Since:
3.0
Prevents the original behavior of the event to happen. It can optionally
stop propagating the event in the event chain.
var element = CKEDITOR.document.getById( 'myElement' ); element.on( 'click', function( ev ) { // The DOM event object is passed by the "data" property. var domEvent = ev.data; // Prevent the click to chave any effect in the element. domEvent.preventDefault(); });
- Parameters:
- {Boolean} stopPropagation Optional
- Stop propagating this event in the event chain.
{Undefined}
stopPropagation()
Since:
3.0
NO EXAMPLE AVAILABLE