'use strict';

exports.__esModule = true;
function select(el) {
  if (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA') {
    el.select();
    el.setSelectionRange(0, el.value.length);
  } else {
    var range = void 0;
    if (document.selection) {
      range = document.body.createTextRange();
      range.moveToElementText(el);
      range.select();
    } else if (window.getSelection) {
      var selection = window.getSelection(); // Save the selection.
      range = document.createRange();
      range.selectNodeContents(el);
      selection.removeAllRanges(); // Remove all ranges from the selection.
      selection.addRange(range); // Add the new range.
    }
  }
}

exports.default = select;