selection.js 556 B

1234567891011121314151617
  1. import { isClickableInput } from '../click/isClickableInput.js';
  2. import { isEditableInputOrTextArea } from '../edit/isEditable.js';
  3. /**
  4. * Determine if the element has its own selection implementation
  5. * and does not interact with the Document Selection API.
  6. */ function hasOwnSelection(node) {
  7. return isElement(node) && isEditableInputOrTextArea(node);
  8. }
  9. function hasNoSelection(node) {
  10. return isElement(node) && isClickableInput(node);
  11. }
  12. function isElement(node) {
  13. return node.nodeType === 1;
  14. }
  15. export { hasNoSelection, hasOwnSelection };