code: function getSelection(node) {
    if ('selectionStart' in node && hasSelectionCapabilities(node)) {
      return {
        start: node.selectionStart,
        end: node.selectionEnd
      };
    } else if (window.getSelection) {
      var selection = window.getSelection();
      return {
        anchorNode: selection.anchorNode,
        anchorOffset: selection.anchorOffset,
        focusNode: selection.focusNode,
        focusOffset: selection.focusOffset
      };
    }
  }
docs: Get an object which is a unique representation of the current selection.
  
  The return value will not be consistent across nodes or browsers, but
  two identical selections on the same node will return identical objects.
  
  @param {DOMElement} node
  @return {object}