tinymce.full.js
function (oldItem, newItem) {
        var ctrlElm, items = this.items(), i = items.length;

        // Replace the item in collection
        while (i--) {
          if (items[i] === oldItem) {
            items[i] = newItem;
            break;
          }
        }

        if (i >= 0) {
          // Remove new item from DOM
          ctrlElm = newItem.getEl();
          if (ctrlElm) {
            ctrlElm.parentNode.removeChild(ctrlElm);
          }

          // Remove old item from DOM
          ctrlElm = oldItem.getEl();
          if (ctrlElm) {
            ctrlElm.parentNode.removeChild(ctrlElm);
          }
        }

        // Adopt the item
        newItem.parent(this);
      }
function (oldItem, newItem) {
        var ctrlElm, items = this.items(), i = items.length;

        // Replace the item in collection
        while (i--) {
          if (items[i] === oldItem) {
            items[i] = newItem;
            break;
          }
        }

        if (i >= 0) {
          // Remove new item from DOM
          ctrlElm = newItem.getEl();
          if (ctrlElm) {
            ctrlElm.parentNode.removeChild(ctrlElm);
          }

          // Remove old item from DOM
          ctrlElm = oldItem.getEl();
          if (ctrlElm) {
            ctrlElm.parentNode.removeChild(ctrlElm);
          }
        }

        // Adopt the item
        newItem.parent(this);
      }
function ( oldItem , newItem ) { var ctrlElm , items = this . items ( ) , i = items . length ; // Replace the item in collection while ( i -- ) { if ( items [ i ] === oldItem ) { items [ i ] = newItem ; break ; } } if ( i >= 0 ) { // Remove new item from DOM ctrlElm = newItem . getEl ( ) ; if ( ctrlElm ) { ctrlElm . parentNode . removeChild ( ctrlElm ) ; } // Remove old item from DOM ctrlElm = oldItem . getEl ( ) ; if ( ctrlElm ) { ctrlElm . parentNode . removeChild ( ctrlElm ) ; } } // Adopt the item newItem . parent ( this ) ; }
Replaces the specified child control with a new control.

@method replace
@param {tinymce.ui.Control} oldItem Old item to be replaced.
@param {tinymce.ui.Control} newItem New item to be inserted.
Replaces the specified child control with a new control .