CKEditor 4 Documentation

CKEDITOR.dom.domObject

Mixins

Subclasses

Files

Represents a DOM object. This class is not intended to be used directly. It serves as the base class for other classes representing specific DOM objects.

Defined By

Properties

CKEDITOR.dom.domObject
view source
: Objectreadonly
The native DOM object represented by this class instance. ...

The native DOM object represented by this class instance.

var element = new CKEDITOR.dom.element( 'span' );
alert( element.$.nodeType ); // '1'
Defined By

Methods

CKEDITOR.dom.domObject
view source
new( nativeDomObject ) : CKEDITOR.dom.domObject
Creates a domObject class instance. ...

Creates a domObject class instance.

Parameters

  • nativeDomObject : Object

    A native DOM object.

Returns

Overrides: CKEDITOR.event.constructor

Register event handler under the capturing stage on supported target. ...

Register event handler under the capturing stage on supported target.

CKEDITOR.dom.domObject
view source
( )
Removes any data stored in this object. ...

Removes any data stored in this object. To avoid memory leaks we must assure that there are no references left after the object is no longer needed.

Predefine some intrinsic properties on a specific event name. ...

Predefine some intrinsic properties on a specific event name.

Parameters

  • name : String

    The event name

  • meta : Object
    • errorProof : (optional)

      Whether the event firing should catch error thrown from a per listener call.

      Defaults to: false

CKEDITOR.dom.domObject
view source
( object ) : Boolean
Determines whether the specified object is equal to the current object. ...

Determines whether the specified object is equal to the current object.

var doc = new CKEDITOR.dom.document( document );
alert( doc.equals( CKEDITOR.document ) );   // true
alert( doc == CKEDITOR.document );          // false

Parameters

  • object : Object

    The object to compare with the current object.

Returns

  • Boolean

    true if the object is equal.

( eventName, [data], [editor] ) : Boolean/Object
Fires an specific event in the object. ...

Fires an specific event in the object. All registered listeners are called at this point.

someObject.on( 'someEvent', function() { ... } );
someObject.on( 'someEvent', function() { ... } );
someObject.fire( 'someEvent' );             // Both listeners are called.

someObject.on( 'someEvent', function( event ) {
    alert( event.data );                    // 'Example'
} );
someObject.fire( 'someEvent', 'Example' );

Parameters

Returns

  • Boolean/Object

    A boolean indicating that the event is to be canceled, or data returned by one of the listeners.

( eventName, [data], [editor] ) : Boolean/Object
Fires an specific event in the object, releasing all listeners registered to that event. ...

Fires an specific event in the object, releasing all listeners registered to that event. The same listeners are not called again on successive calls of it or of fire.

someObject.on( 'someEvent', function() { ... } );
someObject.fire( 'someEvent' );         // Above listener called.
someObject.fireOnce( 'someEvent' );     // Above listener called.
someObject.fire( 'someEvent' );         // No listeners called.

Parameters

Returns

  • Boolean/Object

    A booloan indicating that the event is to be canceled, or data returned by one of the listeners.

CKEDITOR.dom.domObject
view source
( key ) : Object
Gets the value set to a data slot in this object. ...

Gets the value set to a data slot in this object.

var element = new CKEDITOR.dom.element( 'span' );
alert( element.getCustomData( 'hasCustomData' ) );      // e.g. 'true'
alert( element.getCustomData( 'nonExistingKey' ) );     // null

Parameters

  • key : String

    The key used to identify the data slot.

Returns

  • Object

    This value set to the data slot.

CKEDITOR.dom.domObject
view source
( ) : Object
Gets the private _ object which is bound to the native DOM object using getCustomData. ...

Gets the private _ object which is bound to the native DOM object using getCustomData.

var elementA = new CKEDITOR.dom.element( nativeElement );
elementA.getPrivate().value = 1;
...
var elementB = new CKEDITOR.dom.element( nativeElement );
elementB.getPrivate().value; // 1

Returns

  • Object

    The private object.

CKEDITOR.dom.domObject
view source
( ) : Number
Gets an ID that can be used to identify this DOM object in the running session. ...

Gets an ID that can be used to identify this DOM object in the running session.

Note: This method does not work on text nodes prior to Internet Explorer 9.

Returns

  • Number

    A unique ID.

Checks if there is any listener registered to a given event. ...

Checks if there is any listener registered to a given event.

var myListener = function() { ... };
someObject.on( 'someEvent', myListener );
alert( someObject.hasListeners( 'someEvent' ) );    // true
alert( someObject.hasListeners( 'noEvent' ) );      // false

Parameters

  • eventName : String

    The event name.

Returns

  • Boolean
( eventName, listenerFunction, [scopeObj], [listenerData], [priority] ) : Object
Registers a listener to a specific event in the current object. ...

Registers a listener to a specific event in the current object.

someObject.on( 'someEvent', function() {
    alert( this == someObject );        // true
} );

someObject.on( 'someEvent', function() {
    alert( this == anotherObject );     // true
}, anotherObject );

someObject.on( 'someEvent', function( event ) {
    alert( event.listenerData );        // 'Example'
}, null, 'Example' );

someObject.on( 'someEvent', function() { ... } );                       // 2nd called
someObject.on( 'someEvent', function() { ... }, null, null, 100 );      // 3rd called
someObject.on( 'someEvent', function() { ... }, null, null, 1 );        // 1st called

Parameters

  • eventName : String

    The event name to which listen.

  • listenerFunction : Function

    The function listening to the event. A single CKEDITOR.eventInfo object instanced is passed to this function containing all the event data.

  • scopeObj : Object (optional)

    The object used to scope the listener call (the this object). If omitted, the current object is used.

  • listenerData : Object (optional)

    Data to be sent as the CKEDITOR.eventInfo.listenerData when calling the listener.

  • priority : Number (optional)

    The listener priority. Lower priority listeners are called first. Listeners with the same priority value are called in registration order.

    Defaults to: 10

Returns

  • Object

    An object containing the removeListener function, which can be used to remove the listener at any time.

Similiar with on but the listener will be called only once upon the next event firing. ...

Similiar with on but the listener will be called only once upon the next event firing.

CKEDITOR.event.on

CKEDITOR.dom.domObject
view source
( )
Removes any listener set on this object. ...

Removes any listener set on this object.

To avoid memory leaks we must assure that there are no references left after the object is no longer needed.

Overrides: CKEDITOR.event.removeAllListeners

CKEDITOR.dom.domObject
view source
( key ) : Object
Removes the value in the data slot under the given key. ...

Removes the value in the data slot under the given key.

Parameters

  • key : String

Returns

  • Object

    Removed value or null if not found.

( eventName, listenerFunction )
Unregisters a listener function from being called at the specified event. ...

Unregisters a listener function from being called at the specified event. No errors are thrown if the listener has not been registered previously.

var myListener = function() { ... };
someObject.on( 'someEvent', myListener );
someObject.fire( 'someEvent' );                 // myListener called.
someObject.removeListener( 'someEvent', myListener );
someObject.fire( 'someEvent' );                 // myListener not called.

Parameters

  • eventName : String

    The event name.

  • listenerFunction : Function

    The listener function to unregister.

CKEDITOR.dom.domObject
view source
( key, value ) : CKEDITOR.dom.domObjectchainable
Sets a data slot value for this object. ...

Sets a data slot value for this object. These values are shared by all instances pointing to that same DOM object.

Note: The created data slot is only guaranteed to be available on this unique DOM node, thus any wish to continue access to it from other element clones (either created by clone node or from innerHtml) will fail. For such usage please use CKEDITOR.dom.element.setAttribute instead.

Note: This method does not work on text nodes prior to Internet Explorer 9.

var element = new CKEDITOR.dom.element( 'span' );
element.setCustomData( 'hasCustomData', true );

Parameters

  • key : String

    A key used to identify the data slot.

  • value : Object

    The value to set to the data slot.

Returns