{\r
var functions = [];\r
\r
+ CKEDITOR.on( 'reset', function()\r
+ {\r
+ functions = [];\r
+ });\r
+\r
/**\r
* Utility functions.\r
* @namespace\r
} )(),\r
\r
/**\r
- * Build the HTML snippet of a set of <style>/<link>.\r
+ * Build the HTML snippet of a set of <style>/<link>.\r
* @param css {String|Array} Each of which are url (absolute) of a CSS file or\r
* a trunk of style text.\r
*/\r
},\r
\r
/**\r
+ * Replace special HTML characters in HTMLElement's attribute with their relative HTML entity values.\r
+ * @param {String} The attribute's value to be encoded.\r
+ * @returns {String} The encode value.\r
+ * @example\r
+ * element.setAttribute( 'title', '<a " b >' );\r
+ * alert( CKEDITOR.tools.htmlEncodeAttr( element.getAttribute( 'title' ) ); // ">a " b <"\r
+ */\r
+ htmlEncodeAttr : function( text )\r
+ {\r
+ return text.replace( /"/g, '"' ).replace( /</g, '<' ).replace( />/, '>' );\r
+ },\r
+\r
+ /**\r
* Replace characters can't be represented through CSS Selectors string\r
* by CSS Escape Notation where the character escape sequence consists\r
* of a backslash character (\) followed by the orginal characters.\r
* <li> Public (prototype) fields </li>\r
* <li> Chainable base class constructor </li>\r
* </ul>\r
- * @param {Object} definiton The class definiton object.\r
+ * @param {Object} definition The class definition object.\r
* @returns {Function} A class-like JavaScript function.\r
*/\r
createClass : function( definition )\r
},\r
\r
/**\r
+ * Removes the function reference created with {@see CKEDITOR.tools.addFunction}.\r
+ * @param {Number} ref The function reference created with\r
+ * CKEDITOR.tools.addFunction.\r
+ */\r
+ removeFunction : function( ref )\r
+ {\r
+ functions[ ref ] = null;\r
+ },\r
+\r
+ /**\r
* Executes a function based on the reference created with\r
* CKEDITOR.tools.addFunction.\r
* @param {Number} ref The function reference created with\r
catch (e) {}\r
}\r
return returnValue;\r
+ },\r
+\r
+ /**\r
+ * Generate a combined key from a series of params.\r
+ * @param {String} subKey One or more string used as sub keys.\r
+ * @example\r
+ * var key = CKEDITOR.tools.genKey( 'key1', 'key2', 'key3' );\r
+ * alert( key ); // "key1-key2-key3".\r
+ */\r
+ genKey : function()\r
+ {\r
+ return Array.prototype.slice.call( arguments ).join( '-' );\r
}\r
};\r
})();\r