function(controlRange) {
      var selection,
          range;

      if (controlRange && this.doc.selection && this.doc.selection.type === "Control") {
        range = this.doc.selection.createRange();
        if (range && range.length) {
          return range.item(0);
        }
      }

      selection = this.getSelection(this.doc);
      if (selection.focusNode === selection.anchorNode) {
        return selection.focusNode;
      } else {
        range = this.getRange(this.doc);
        return range ? range.commonAncestorContainer : this.doc.body;
      }
    }
function(controlRange) {
      var selection,
          range;

      if (controlRange && this.doc.selection && this.doc.selection.type === "Control") {
        range = this.doc.selection.createRange();
        if (range && range.length) {
          return range.item(0);
        }
      }

      selection = this.getSelection(this.doc);
      if (selection.focusNode === selection.anchorNode) {
        return selection.focusNode;
      } else {
        range = this.getRange(this.doc);
        return range ? range.commonAncestorContainer : this.doc.body;
      }
    }
function ( controlRange ) { var selection , range ; if ( controlRange && this . doc . selection && this . doc . selection . type === "Control" ) { range = this . doc . selection . createRange ( ) ; if ( range && range . length ) { return range . item ( 0 ) ; } } selection = this . getSelection ( this . doc ) ; if ( selection . focusNode === selection . anchorNode ) { return selection . focusNode ; } else { range = this . getRange ( this . doc ) ; return range ? range . commonAncestorContainer : this . doc . body ; } }
Get the node which contains the selection

@param {Boolean} [controlRange] (only IE) Whether it should return the selected ControlRange element when the selection type is a "ControlRange"
@return {Object} The node that contains the caret
@example
var nodeThatContainsCaret = selection.getSelectedNode();
Get the node which contains the selection
Returns the first ancestor of the selection