Selection
Types
t
A Selection object represents the range of text selected by the user or the current position of the caret. To obtain a Selection object for examination or modification, call Window.getSelection(). See Selection on MDN
type t = private { anchorNode: Null.t<WebAPI.DOMTree.node>, anchorOffset: int, focusNode: Null.t<WebAPI.DOMTree.node>, focusOffset: int, isCollapsed: bool, rangeCount: int, type_: string, direction: string,}Record fields
Values
addRange
let addRange: (t, WebAPI.Range.t) => unitcollapse
let collapse: (t, ~node: WebAPI.DOMTree.node, ~offset: int=?) => unitcontainsNode
let containsNode: ( t, ~node: WebAPI.DOMTree.node, ~allowPartialContainment: bool=?,) => boolextend
let extend: (t, ~node: WebAPI.DOMTree.node, ~offset: int=?) => unitgetRangeAt
let getRangeAt: (t, int) => WebAPI.Range.tmodify
let modify: ( t, ~alter: string=?, ~direction: string=?, ~granularity: string=?,) => unitremoveRange
let removeRange: (t, WebAPI.Range.t) => unitselectAllChildren
let selectAllChildren: (t, WebAPI.DOMTree.node) => unitsetBaseAndExtent
let setBaseAndExtent: ( t, ~anchorNode: WebAPI.DOMTree.node, ~anchorOffset: int, ~focusNode: WebAPI.DOMTree.node, ~focusOffset: int,) => unitsetPosition
let setPosition: (t, ~node: WebAPI.DOMTree.node, ~offset: int=?) => unit