Skip to content

Commit

Permalink
Restore FireFox-only caretPositionFromPoint type
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Aug 30, 2021
1 parent 04b2b09 commit b4636c1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/dom/src/dom/caret-range-from-point.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint
*
* @param {Document} doc The document of the range.
* @param {DocumentMaybeWithCaretPositionFromPoint} doc The document of the range.
* @param {number} x Horizontal position within the current viewport.
* @param {number} y Vertical position within the current viewport.
*
Expand Down Expand Up @@ -34,3 +34,8 @@ export default function caretRangeFromPoint( doc, x, y ) {

return range;
}

/**
* @typedef {{caretPositionFromPoint?: (x: number, y: number)=> CaretPosition | null} & Document } DocumentMaybeWithCaretPositionFromPoint
* @typedef {{ readonly offset: number; readonly offsetNode: Node; getClientRect(): DOMRect | null; }} CaretPosition
*/

0 comments on commit b4636c1

Please sign in to comment.