plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
function parse(elementOrHtml, config) {
    wysihtml5.lang.object(currentRules).merge(defaultRules).merge(config.rules).get();

    var context       = config.context || elementOrHtml.ownerDocument || document,
        fragment      = context.createDocumentFragment(),
        isString      = typeof(elementOrHtml) === "string",
        clearInternals = false,
        element,
        newNode,
        firstChild;

    if (config.clearInternals === true) {
      clearInternals = true;
    }

    if (isString) {
      element = wysihtml5.dom.getAsDom(elementOrHtml, context);
    } else {
      element = elementOrHtml;
    }

    if (currentRules.selectors) {
      _applySelectorRules(element, currentRules.selectors);
    }

    while (element.firstChild) {
      firstChild = element.firstChild;
      newNode = _convert(firstChild, config.cleanUp, clearInternals, config.uneditableClass);
      if (newNode) {
        fragment.appendChild(newNode);
      }
      if (firstChild !== newNode) {
        element.removeChild(firstChild);
      }
    }

    if (config.unjoinNbsps) {
      // replace joined non-breakable spaces with unjoined
      var txtnodes = wysihtml5.dom.getTextNodes(fragment);
      for (var n = txtnodes.length; n--;) {
        txtnodes[n].nodeValue = txtnodes[n].nodeValue.replace(/([\S\u00A0])\u00A0/gi, "$1 ");
      }
    }

    // Clear element contents
    element.innerHTML = "";

    // Insert new DOM tree
    element.appendChild(fragment);

    return isString ? wysihtml5.quirks.getCorrectInnerHTML(element) : element;
  }
function parse(elementOrHtml, config) {
    wysihtml5.lang.object(currentRules).merge(defaultRules).merge(config.rules).get();

    var context       = config.context || elementOrHtml.ownerDocument || document,
        fragment      = context.createDocumentFragment(),
        isString      = typeof(elementOrHtml) === "string",
        clearInternals = false,
        element,
        newNode,
        firstChild;

    if (config.clearInternals === true) {
      clearInternals = true;
    }

    if (isString) {
      element = wysihtml5.dom.getAsDom(elementOrHtml, context);
    } else {
      element = elementOrHtml;
    }

    if (currentRules.selectors) {
      _applySelectorRules(element, currentRules.selectors);
    }

    while (element.firstChild) {
      firstChild = element.firstChild;
      newNode = _convert(firstChild, config.cleanUp, clearInternals, config.uneditableClass);
      if (newNode) {
        fragment.appendChild(newNode);
      }
      if (firstChild !== newNode) {
        element.removeChild(firstChild);
      }
    }

    if (config.unjoinNbsps) {
      // replace joined non-breakable spaces with unjoined
      var txtnodes = wysihtml5.dom.getTextNodes(fragment);
      for (var n = txtnodes.length; n--;) {
        txtnodes[n].nodeValue = txtnodes[n].nodeValue.replace(/([\S\u00A0])\u00A0/gi, "$1 ");
      }
    }

    // Clear element contents
    element.innerHTML = "";

    // Insert new DOM tree
    element.appendChild(fragment);

    return isString ? wysihtml5.quirks.getCorrectInnerHTML(element) : element;
  }
function parse ( elementOrHtml , config ) { wysihtml5 . lang . object ( currentRules ) . merge ( defaultRules ) . merge ( config . rules ) . get ( ) ; var context = config . context || elementOrHtml . ownerDocument || document , fragment = context . createDocumentFragment ( ) , isString = typeof ( elementOrHtml ) === "string" , clearInternals = false , element , newNode , firstChild ; if ( config . clearInternals === true ) { clearInternals = true ; } if ( isString ) { element = wysihtml5 . dom . getAsDom ( elementOrHtml , context ) ; } else { element = elementOrHtml ; } if ( currentRules . selectors ) { _applySelectorRules ( element , currentRules . selectors ) ; } while ( element . firstChild ) { firstChild = element . firstChild ; newNode = _convert ( firstChild , config . cleanUp , clearInternals , config . uneditableClass ) ; if ( newNode ) { fragment . appendChild ( newNode ) ; } if ( firstChild !== newNode ) { element . removeChild ( firstChild ) ; } } if ( config . unjoinNbsps ) { // replace joined non-breakable spaces with unjoined var txtnodes = wysihtml5 . dom . getTextNodes ( fragment ) ; for ( var n = txtnodes . length ; n -- ; ) { txtnodes [ n ] . nodeValue = txtnodes [ n ] . nodeValue . replace ( / ([\S\u00A0])\u00A0 / gi , "$1 " ) ; } } // Clear element contents element . innerHTML = "" ; // Insert new DOM tree element . appendChild ( fragment ) ; return isString ? wysihtml5 . quirks . getCorrectInnerHTML ( element ) : element ; }
Iterates over all childs of the element, recreates them, appends them into a document fragment
which later replaces the entire body content
Iterates over all childs of the element recreates them appends them into a document fragment which later replaces the entire body content