code: function getRange(sel) {
  	sel = sel || getSelection();
  	return sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
  }
docs: Get a Selection's Range
  @see http://stackoverflow.com/questions/13949059/persisting-the-changes-of-range-objects-after-selection-in-html/13950376#13950376
  @param {Selection} sel
  @return {Range|null}