diff --git a/editor/utils/dom.js b/editor/utils/dom.js index 859f46d95e2c2a..47dac0a42e7d03 100644 --- a/editor/utils/dom.js +++ b/editor/utils/dom.js @@ -342,6 +342,14 @@ export function documentHasSelection() { return range && ! range.collapsed; } +/** + * Check wether the contents of the element have been fully selected. + * Returns true if there is no possibility of full selection. + * + * @param {Element} element The element to check. + * + * @returns {Boolean} True if fully selected, false if not. + */ export function isFullySelected( element ) { if ( includes( [ 'INPUT', 'TEXTAREA' ], element.nodeName ) ) { return element.selectionStart === 0 && element.value.length === element.selectionEnd;