Skip to content

Commit 7a5ec9d

Browse files
authored
Merge pull request #340 from mariusschulz/setSelectionRange
Fix type declarations for "setSelectionRange" API
2 parents 5e66360 + 230e4a3 commit 7a5ec9d

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

baselines/dom.generated.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5500,8 +5500,9 @@ interface HTMLInputElement extends HTMLElement {
55005500
* Sets the start and end positions of a selection in a text field.
55015501
* @param start The offset into the text field for the start of the selection.
55025502
* @param end The offset into the text field for the end of the selection.
5503+
* @param direction The direction in which the selection is performed.
55035504
*/
5504-
setSelectionRange(start?: number, end?: number, direction?: string): void;
5505+
setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void;
55055506
/**
55065507
* Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value.
55075508
* @param n Value to decrement the value by.
@@ -6964,8 +6965,9 @@ interface HTMLTextAreaElement extends HTMLElement {
69646965
* Sets the start and end positions of a selection in a text field.
69656966
* @param start The offset into the text field for the start of the selection.
69666967
* @param end The offset into the text field for the end of the selection.
6968+
* @param direction The direction in which the selection is performed.
69676969
*/
6968-
setSelectionRange(start: number, end: number): void;
6970+
setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void;
69696971
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
69706972
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
69716973
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;

inputfiles/comments.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@
19481948
},
19491949
{
19501950
"name": "setSelectionRange",
1951-
"comment": "/**\r\n * Sets the start and end positions of a selection in a text field.\r\n * @param start The offset into the text field for the start of the selection.\r\n * @param end The offset into the text field for the end of the selection.\r\n */"
1951+
"comment": "/**\r\n * Sets the start and end positions of a selection in a text field.\r\n * @param start The offset into the text field for the start of the selection.\r\n * @param end The offset into the text field for the end of the selection.\r\n * @param direction The direction in which the selection is performed.\r\n */"
19521952
},
19531953
{
19541954
"name": "select",
@@ -2335,7 +2335,7 @@
23352335
},
23362336
{
23372337
"name": "setSelectionRange",
2338-
"comment": "/**\r\n * Sets the start and end positions of a selection in a text field.\r\n * @param start The offset into the text field for the start of the selection.\r\n * @param end The offset into the text field for the end of the selection.\r\n */"
2338+
"comment": "/**\r\n * Sets the start and end positions of a selection in a text field.\r\n * @param start The offset into the text field for the start of the selection.\r\n * @param end The offset into the text field for the end of the selection.\r\n * @param direction The direction in which the selection is performed.\r\n */"
23392339
},
23402340
{
23412341
"name": "select",

inputfiles/overridingTypes.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,5 +1739,21 @@
17391739
"readonly": true,
17401740
"name": "lastModifiedDate",
17411741
"type": "Date"
1742+
},
1743+
{
1744+
"kind": "method",
1745+
"interface": "HTMLInputElement",
1746+
"name": "setSelectionRange",
1747+
"signatures": [
1748+
"setSelectionRange(start: number, end: number, direction?: \"forward\" | \"backward\" | \"none\"): void"
1749+
]
1750+
},
1751+
{
1752+
"kind": "method",
1753+
"interface": "HTMLTextAreaElement",
1754+
"name": "setSelectionRange",
1755+
"signatures": [
1756+
"setSelectionRange(start: number, end: number, direction?: \"forward\" | \"backward\" | \"none\"): void"
1757+
]
17421758
}
17431759
]

0 commit comments

Comments
 (0)