Code Index | File Index

Namespaces

Classes


Namespace CKEDITOR.tools

Utility functions.
Defined in: core/tools.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Utility functions.
Field Summary
Field Attributes Field Name and Description
<static>  
CKEDITOR.tools.getNextNumber
Gets a unique number for this CKEDITOR execution session.
Method Summary
Method Attributes Method Name and Description
<static>  
CKEDITOR.tools.cssStyleToDomStyle(cssName)
Transforms a CSS property name to its relative DOM style name.
<static>  
CKEDITOR.tools.extend(target, source, overwrite)
Copy the properties from one object to another.
<static>  
CKEDITOR.tools.globalEval(script, win)
Evaluates a script in a window (global) scope.
<static>  
CKEDITOR.tools.htmlEncode(text)
Replace special HTML characters in a string with their relative HTML entity values.
<static>  
CKEDITOR.tools.isArray(object)
Checks if an object is an Array.
<static>  
CKEDITOR.tools.setTimeout(func, milliseconds, scope, args, ownerWindow)
Executes a function after specified delay.
Namespace Detail
CKEDITOR.tools
Since: 3.0
Utility functions.
Field Detail
<static> {Number} CKEDITOR.tools.getNextNumber
Since: 3.0
Gets a unique number for this CKEDITOR execution session. It returns progressive numbers starting at 1.
alert( CKEDITOR.tools.getNextNumber() );  // "1" (e.g.)
alert( CKEDITOR.tools.getNextNumber() );  // "2"
Method Detail
<static> {String} CKEDITOR.tools.cssStyleToDomStyle(cssName)
Since: 3.0
Transforms a CSS property name to its relative DOM style name.
alert( CKEDITOR.tools.cssStyleToDomStyle( 'background-color' ) );  // "backgroundColor"
alert( CKEDITOR.tools.cssStyleToDomStyle( 'float' ) );             // "cssFloat"
Parameters:
{String} cssName
The CSS property name.
Returns:
{String} The transformed name.

<static> {Object} CKEDITOR.tools.extend(target, source, overwrite)
Since: 3.0
Copy the properties from one object to another. By default, properties already present in the target object are not overwritten.
// Create the sample object.
var myObject =
{
    prop1 : true
};

// Extend the above object with two properties.
CKEDITOR.tools.extend( myObject,
    {
        prop2 : true,
        prop3 : true
    } );

// Alert "prop1", "prop2" and "prop3".
for ( var p in myObject )
    alert( p );
Parameters:
{Object} target
The object to be extended.
{Object} source
The object from which copy properties.
{Boolean} overwrite Optional
Indicates that properties already present in the target object must be overwritten.
Returns:
{Object} the extended object (target).

<static> {Undefined} CKEDITOR.tools.globalEval(script, win)
Since: 3.0
Evaluates a script in a window (global) scope.
var script = 'function sample() { alert( "Go!" ); }';

// Evaluates a script in the current window.
CKEDITOR.tools.globalEval( script );

// Evaluates a script in the parent window.
CKEDITOR.tools.globalEval( script, window.parent );

// Alerts "Go!" twice.
window.sample();
window.parent.sample();
Parameters:
{String} script
The script code to be evaluated.
{Object} win Optional
The target window. Defaults to the current window.

<static> {String} CKEDITOR.tools.htmlEncode(text)
Since: 3.0
Replace special HTML characters in a string with their relative HTML entity values.
alert( CKEDITOR.tools.htmlEncode( 'A > B & C < D' ) );  // "A &gt; B &amp; C &lt; D"
Parameters:
{String} text
The string to be encoded.
Returns:
{String} The encode string.

<static> {Boolean} CKEDITOR.tools.isArray(object)
Since: 3.0
Checks if an object is an Array.
alert( CKEDITOR.tools.isArray( [] ) );      // "true"
alert( CKEDITOR.tools.isArray( 'Test' ) );  // "false"
Parameters:
{Object} object
The object to be checked.
Returns:
true if the object is an Array, otherwise false.

<static> {Object} CKEDITOR.tools.setTimeout(func, milliseconds, scope, args, ownerWindow)
Since: 3.0
Executes a function after specified delay.
CKEDITOR.tools.setTimeout(
    function()
    {
        alert( 'Executed after 2 seconds' );
    },
    2000 );
Parameters:
{Function} func
The function to be executed.
{Number} milliseconds Optional
The amount of time (millisecods) to wait to fire the function execution. Defaults to zero.
{Object} scope Optional
The object to hold the function execution scope (the "this" object). By default the "window" object.
{Object|Array} args Optional
A single object, or an array of objects, to pass as arguments to the function.
{Object} ownerWindow Optional
The window that will be used to set the timeout. By default the current "window".
Returns:
{Object} A value that can be used to cancel the function execution.

Documentation generated by JsDoc Toolkit