torso-bundle.js
function(currentNode, newNode, ignoreElements) {
      var currentCaret, activeElement,
          currentNodeContainsActiveElement = false;
      try {
        activeElement = document.activeElement;
      } catch (error) {
        activeElement = null;
      }
      if (activeElement && currentNode && $.contains(activeElement, currentNode)) {
        currentNodeContainsActiveElement = true;
      }
      if (currentNodeContainsActiveElement && this.supportsSelection(activeElement)) {
        currentCaret = this.getCaretPosition(activeElement);
      }
      this.hotswap(currentNode, newNode, ignoreElements);
      if (currentNodeContainsActiveElement && this.supportsSelection(activeElement)) {
        this.setCaretPosition(activeElement, currentCaret);
      }
    }
function(currentNode, newNode, ignoreElements) {
      var currentCaret, activeElement,
          currentNodeContainsActiveElement = false;
      try {
        activeElement = document.activeElement;
      } catch (error) {
        activeElement = null;
      }
      if (activeElement && currentNode && $.contains(activeElement, currentNode)) {
        currentNodeContainsActiveElement = true;
      }
      if (currentNodeContainsActiveElement && this.supportsSelection(activeElement)) {
        currentCaret = this.getCaretPosition(activeElement);
      }
      this.hotswap(currentNode, newNode, ignoreElements);
      if (currentNodeContainsActiveElement && this.supportsSelection(activeElement)) {
        this.setCaretPosition(activeElement, currentCaret);
      }
    }
function ( currentNode , newNode , ignoreElements ) { var currentCaret , activeElement , currentNodeContainsActiveElement = false ; try { activeElement = document . activeElement ; } catch ( error ) { activeElement = null ; } if ( activeElement && currentNode && $ . contains ( activeElement , currentNode ) ) { currentNodeContainsActiveElement = true ; } if ( currentNodeContainsActiveElement && this . supportsSelection ( activeElement ) ) { currentCaret = this . getCaretPosition ( activeElement ) ; } this . hotswap ( currentNode , newNode , ignoreElements ) ; if ( currentNodeContainsActiveElement && this . supportsSelection ( activeElement ) ) { this . setCaretPosition ( activeElement , currentCaret ) ; } }
Call this.hotswap but also keeps the caret position the same
@param currentNode {Node} The DOM Node corresponding to the existing page content to update
@param newNode {Node} The detached DOM Node representing the desired DOM subtree
@param ignoreElements {Array} Array of jQuery selectors for DOM Elements to ignore during render. Can be an expensive check.
@method hotswapKeepCaret
Call this . hotswap but also keeps the caret position the same