UNPKG

@gechiui/dom

Version:
30 lines (24 loc) 1.05 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = documentHasUncollapsedSelection; var _documentHasTextSelection = _interopRequireDefault(require("./document-has-text-selection")); var _inputFieldHasUncollapsedSelection = _interopRequireDefault(require("./input-field-has-uncollapsed-selection")); /** * Internal dependencies */ /** * Check whether the current document has any sort of selection. This includes * ranges of text across elements and any selection inside `<input>` and * `<textarea>` elements. * * @param {Document} doc The document to check. * * @return {boolean} Whether there is any sort of "selection" in the document. */ function documentHasUncollapsedSelection(doc) { return (0, _documentHasTextSelection.default)(doc) || !!doc.activeElement && (0, _inputFieldHasUncollapsedSelection.default)(doc.activeElement); } //# sourceMappingURL=document-has-uncollapsed-selection.js.map