function hasSelectionCapabilities(elem) {
    var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
    return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true');
  }
@hasSelectionCapabilities: we get the element types that support selection
from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart`
and `selectionEnd` rows.