tinymce.full.js
function formatChanged(formats, callback, similar) {
        var currentFormats;

        // Setup format node change logic
        if (!formatChangeData) {
          formatChangeData = {};
          currentFormats = {};

          ed.on('NodeChange', function (e) {
            var parents = getParents(e.element), matchedFormats = {};

            // Ignore bogus nodes like the <a> tag created by moveStart()
            parents = Tools.grep(parents, function (node) {
              return node.nodeType == 1 && !node.getAttribute('data-mce-bogus');
            });

            // Check for new formats
            each(formatChangeData, function (callbacks, format) {
              each(parents, function (node) {
                if (matchNode(node, format, {}, callbacks.similar)) {
                  if (!currentFormats[format]) {
                    // Execute callbacks
                    each(callbacks, function (callback) {
                      callback(true, { node: node, format: format, parents: parents });
                    });

                    currentFormats[format] = callbacks;
                  }

                  matchedFormats[format] = callbacks;
                  return false;
                }

                if (matchesUnInheritedFormatSelector(node, format)) {
                  return false;
                }
              });
            });

            // Check if current formats still match
            each(currentFormats, function (callbacks, format) {
              if (!matchedFormats[format]) {
                delete currentFormats[format];

                each(callbacks, function (callback) {
                  callback(false, { node: e.element, format: format, parents: parents });
                });
              }
            });
          });
        }

        // Add format listeners
        each(formats.split(','), function (format) {
          if (!formatChangeData[format]) {
            formatChangeData[format] = [];
            formatChangeData[format].similar = similar;
          }

          formatChangeData[format].push(callback);
        });

        return this;
      }
function formatChanged(formats, callback, similar) {
        var currentFormats;

        // Setup format node change logic
        if (!formatChangeData) {
          formatChangeData = {};
          currentFormats = {};

          ed.on('NodeChange', function (e) {
            var parents = getParents(e.element), matchedFormats = {};

            // Ignore bogus nodes like the <a> tag created by moveStart()
            parents = Tools.grep(parents, function (node) {
              return node.nodeType == 1 && !node.getAttribute('data-mce-bogus');
            });

            // Check for new formats
            each(formatChangeData, function (callbacks, format) {
              each(parents, function (node) {
                if (matchNode(node, format, {}, callbacks.similar)) {
                  if (!currentFormats[format]) {
                    // Execute callbacks
                    each(callbacks, function (callback) {
                      callback(true, { node: node, format: format, parents: parents });
                    });

                    currentFormats[format] = callbacks;
                  }

                  matchedFormats[format] = callbacks;
                  return false;
                }

                if (matchesUnInheritedFormatSelector(node, format)) {
                  return false;
                }
              });
            });

            // Check if current formats still match
            each(currentFormats, function (callbacks, format) {
              if (!matchedFormats[format]) {
                delete currentFormats[format];

                each(callbacks, function (callback) {
                  callback(false, { node: e.element, format: format, parents: parents });
                });
              }
            });
          });
        }

        // Add format listeners
        each(formats.split(','), function (format) {
          if (!formatChangeData[format]) {
            formatChangeData[format] = [];
            formatChangeData[format].similar = similar;
          }

          formatChangeData[format].push(callback);
        });

        return this;
      }
function formatChanged ( formats , callback , similar ) { var currentFormats ; // Setup format node change logic if ( ! formatChangeData ) { formatChangeData = { } ; currentFormats = { } ; ed . on ( 'NodeChange' , function ( e ) { var parents = getParents ( e . element ) , matchedFormats = { } ; // Ignore bogus nodes like the <a> tag created by moveStart() parents = Tools . grep ( parents , function ( node ) { return node . nodeType == 1 && ! node . getAttribute ( 'data-mce-bogus' ) ; } ) ; // Check for new formats each ( formatChangeData , function ( callbacks , format ) { each ( parents , function ( node ) { if ( matchNode ( node , format , { } , callbacks . similar ) ) { if ( ! currentFormats [ format ] ) { // Execute callbacks each ( callbacks , function ( callback ) { callback ( true , { node : node , format : format , parents : parents } ) ; } ) ; currentFormats [ format ] = callbacks ; } matchedFormats [ format ] = callbacks ; return false ; } if ( matchesUnInheritedFormatSelector ( node , format ) ) { return false ; } } ) ; } ) ; // Check if current formats still match each ( currentFormats , function ( callbacks , format ) { if ( ! matchedFormats [ format ] ) { delete currentFormats [ format ] ; each ( callbacks , function ( callback ) { callback ( false , { node : e . element , format : format , parents : parents } ) ; } ) ; } } ) ; } ) ; } // Add format listeners each ( formats . split ( ',' ) , function ( format ) { if ( ! formatChangeData [ format ] ) { formatChangeData [ format ] = [ ] ; formatChangeData [ format ] . similar = similar ; } formatChangeData [ format ] . push ( callback ) ; } ) ; return this ; }
Executes the specified callback when the current selection matches the formats or not.

@method formatChanged
@param {String} formats Comma separated list of formats to check for.
@param {function} callback Callback with state and args when the format is changed/toggled on/off.
@param {Boolean} similar True/false state if the match should handle similar or exact formats.
Executes the specified callback when the current selection matches the formats or not .