Namespace CKEDITOR.tools
Utility functions.
Defined in: core/tools.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Utility functions.
|
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.
|
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 > B & C < 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.