tinymce.html.js
function(styles, elementName) {
                    var name, value, css = '';

                    function serializeStyles(name) {
                        var styleList, i, l, value;
                        styleList = validStyles[name];
                        if (styleList) {
                            for (i = 0, l = styleList.length; i < l; i++) {
                                name = styleList[i];
                                value = styles[name];
                                value && (css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';');
                            }
                        }
                    }

                    function isValid(name, elementName) {
                        var styleMap;
                        styleMap = invalidStyles['*'];
                        if (styleMap && styleMap[name]) {
                            return false;
                        }
                        styleMap = invalidStyles[elementName];
                        if (styleMap && styleMap[name]) {
                            return false;
                        }
                        return true;
                    }
                    // Serialize styles according to schema
                    if (elementName && validStyles) {
                        // Serialize global styles and element specific styles
                        serializeStyles('*');
                        serializeStyles(elementName);
                    } else {
                        // Output the styles in the order they are inside the object
                        for (name in styles) {
                            value = styles[name];
                            !value || invalidStyles && !isValid(name, elementName) || (css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';');
                        }
                    }
                    return css;
                }
function(styles, elementName) {
                    var name, value, css = '';

                    function serializeStyles(name) {
                        var styleList, i, l, value;
                        styleList = validStyles[name];
                        if (styleList) {
                            for (i = 0, l = styleList.length; i < l; i++) {
                                name = styleList[i];
                                value = styles[name];
                                value && (css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';');
                            }
                        }
                    }

                    function isValid(name, elementName) {
                        var styleMap;
                        styleMap = invalidStyles['*'];
                        if (styleMap && styleMap[name]) {
                            return false;
                        }
                        styleMap = invalidStyles[elementName];
                        if (styleMap && styleMap[name]) {
                            return false;
                        }
                        return true;
                    }
                    // Serialize styles according to schema
                    if (elementName && validStyles) {
                        // Serialize global styles and element specific styles
                        serializeStyles('*');
                        serializeStyles(elementName);
                    } else {
                        // Output the styles in the order they are inside the object
                        for (name in styles) {
                            value = styles[name];
                            !value || invalidStyles && !isValid(name, elementName) || (css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';');
                        }
                    }
                    return css;
                }
function ( styles , elementName ) { var name , value , css = '' ; function serializeStyles ( name ) { var styleList , i , l , value ; styleList = validStyles [ name ] ; if ( styleList ) { for ( i = 0 , l = styleList . length ; i < l ; i ++ ) { name = styleList [ i ] ; value = styles [ name ] ; value && ( css += ( css . length > 0 ? ' ' : '' ) + name + ': ' + value + ';' ) ; } } } function isValid ( name , elementName ) { var styleMap ; styleMap = invalidStyles [ '*' ] ; if ( styleMap && styleMap [ name ] ) { return false ; } styleMap = invalidStyles [ elementName ] ; if ( styleMap && styleMap [ name ] ) { return false ; } return true ; } // Serialize styles according to schema if ( elementName && validStyles ) { // Serialize global styles and element specific styles serializeStyles ( '*' ) ; serializeStyles ( elementName ) ; } else { // Output the styles in the order they are inside the object for ( name in styles ) { value = styles [ name ] ; ! value || invalidStyles && ! isValid ( name , elementName ) || ( css += ( css . length > 0 ? ' ' : '' ) + name + ': ' + value + ';' ) ; } } return css ; }
Serializes the specified style object into a string.

@method serialize
@param {Object} styles Object to serialize as string for example: {border: '1px solid red'}
@param {String} elementName Optional element name, if specified only the styles that matches the schema will be serialized.
@return {String} String representation of the style object for example: border: 1px solid red.
Serializes the specified style object into a string .