CKEDITOR.dom.event
Represents a native DOM event object.
Filtering
Properties
-
The native DOM event object represented by this class instance.
Methods
-
constructor( domEvent ) → event
CKEDITOR.dom.event#constructor
Creates an event class instance.
Parameters
domEvent : Object
A native DOM event object.
Returns
event
-
getKey() → Number
CKEDITOR.dom.event#getKey
Gets the key code associated to the event.
alert( event.getKey() ); // '65' if 'a' has been pressed
Returns
Number
The key code.
-
getKeystroke() → Number
CKEDITOR.dom.event#getKeystroke
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.
-
getPageOffset() → Object
CKEDITOR.dom.event#getPageOffset
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.
Propertiesx : Number
y : Number
-
getPhase() → Number
CKEDITOR.dom.event#getPhase
Returns an integer value that indicates the current processing phase of an event. For browsers that doesn't support event phase, CKEDITOR.EVENT_PHASE_AT_TARGET is always returned.
Returns
-
getTarget() → node
CKEDITOR.dom.event#getTarget
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
node
The target DOM node.
-
preventDefault( [ stopPropagation ] )
CKEDITOR.dom.event#preventDefault
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
[ stopPropagation ] : Boolean
Stop propagating this event in the event chain.
Defaults to
false
-
stopPropagation()
CKEDITOR.dom.event#stopPropagation
Stops this event propagation in the event chain.