interface Selection { anchorNode : null | Node ; anchorOffset : number ; direction : string ; focusNode : null | Node ; focusOffset : number ; isCollapsed : boolean ; rangeCount : number ; type : string ; addRange ( range : Range ) : void ; collapse ( node : null | Node , offset ?: number ) : void ; collapseToEnd () : void ; collapseToStart () : void ; containsNode ( node : Node , allowPartialContainment ?: boolean ) : boolean ; deleteFromDocument () : void ; empty () : void ; extend ( node : Node , offset ?: number ) : void ; getRangeAt ( index : number ) : Range ; modify ( alter ?: string , direction ?: string , granularity ?: string ) : void ; removeAllRanges () : void ; removeRange ( range : Range ) : void ; selectAllChildren ( node : Node ) : void ; setBaseAndExtent ( anchorNode : Node , anchorOffset : number , focusNode : Node , focusOffset : number , ) : void ; setPosition ( node : null | Node , offset ?: number ) : void ; toString () : string ; } Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21702 Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21752 PropertiesReadonly
anchor Node Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21704 Readonly
anchor Offset anchorOffset : number
Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21706 Readonly
direction direction : string
Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21708 Readonly
focus Node Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21710 Readonly
focus Offset focusOffset : number
Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21712 Readonly
is Collapsed isCollapsed : boolean
Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21714 Readonly
range Count rangeCount : number
Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21716 Readonly
type type : string
Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21718 Methodsadd Range addRange ( range : Range ) : void Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21720 collapse collapse ( node : null | Node , offset ?: number ) : void Parameters node : null | Node Optional
offset : number Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21722 collapse To End collapseToEnd () : void Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21724 collapse To Start collapseToStart () : void Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21726 contains Node containsNode ( node : Node , allowPartialContainment ?: boolean ) : boolean Parameters node : Node Optional
allowPartialContainment : boolean Returns boolean Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21728 delete From Document deleteFromDocument () : void Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21730 empty empty () : void Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21732 extend extend ( node : Node , offset ?: number ) : void Parameters node : Node Optional
offset : number Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21734 get Range At getRangeAt ( index : number ) : Range Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21736 modify modify ( alter ?: string , direction ?: string , granularity ?: string ) : void Parameters Optional
alter : string Optional
direction : string Optional
granularity : string Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21738 remove All Ranges removeAllRanges () : void Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21740 remove Range removeRange ( range : Range ) : void Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21742 select All Children selectAllChildren ( node : Node ) : void Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21744 set Base And Extent setBaseAndExtent ( anchorNode : Node , anchorOffset : number , focusNode : Node , focusOffset : number , ) : void Parameters anchorNode : Node anchorOffset : number focusNode : Node focusOffset : number Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21746 set Position setPosition ( node : null | Node , offset ?: number ) : void Parameters node : null | Node Optional
offset : number Returns void Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21748 to String toString () : string Returns string Defined in ../node_modules/typescript/lib/lib.dom.d.ts:21749
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().
MDN Reference