function selectElementIfAllowed(element) {
  var activeElement = element.ownerDocument.activeElement;

  if (!isOutsideInput(activeElement)) {
    element.select();
  }
}
Check if the given DOM element can be focused (by using "select" method).

@param {HTMLElement} element - DOM element