Skip to content

Commit 7aa85ee

Browse files
Bashamegasaschanaz
andauthored
Migrate HTMLTextAreaElement (microsoft#2354)
Co-authored-by: saschanaz <[email protected]>
1 parent f16ed49 commit 7aa85ee

File tree

6 files changed

+28
-50
lines changed

6 files changed

+28
-50
lines changed

baselines/dom.generated.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19852,7 +19852,7 @@ interface HTMLTextAreaElement extends HTMLElement {
1985219852
*
1985319853
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/selectionDirection)
1985419854
*/
19855-
selectionDirection: "forward" | "backward" | "none";
19855+
selectionDirection: SelectionDirection;
1985619856
/**
1985719857
* The **`selectionEnd`** property of the HTMLTextAreaElement interface specifies the end position of the current text selection in a <textarea> element. It is a number representing the last index of the selected text. It can be used to both retrieve and set the index of the end of a <textarea>s selected text.
1985819858
*
@@ -19943,7 +19943,7 @@ interface HTMLTextAreaElement extends HTMLElement {
1994319943
*
1994419944
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/setSelectionRange)
1994519945
*/
19946-
setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void;
19946+
setSelectionRange(start: number | null, end: number | null, direction?: SelectionDirection): void;
1994719947
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1994819948
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1994919949
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;

baselines/ts5.5/dom.generated.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19828,7 +19828,7 @@ interface HTMLTextAreaElement extends HTMLElement {
1982819828
*
1982919829
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/selectionDirection)
1983019830
*/
19831-
selectionDirection: "forward" | "backward" | "none";
19831+
selectionDirection: SelectionDirection;
1983219832
/**
1983319833
* The **`selectionEnd`** property of the HTMLTextAreaElement interface specifies the end position of the current text selection in a <textarea> element. It is a number representing the last index of the selected text. It can be used to both retrieve and set the index of the end of a <textarea>s selected text.
1983419834
*
@@ -19919,7 +19919,7 @@ interface HTMLTextAreaElement extends HTMLElement {
1991919919
*
1992019920
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/setSelectionRange)
1992119921
*/
19922-
setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void;
19922+
setSelectionRange(start: number | null, end: number | null, direction?: SelectionDirection): void;
1992319923
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1992419924
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1992519925
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;

baselines/ts5.6/dom.generated.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19849,7 +19849,7 @@ interface HTMLTextAreaElement extends HTMLElement {
1984919849
*
1985019850
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/selectionDirection)
1985119851
*/
19852-
selectionDirection: "forward" | "backward" | "none";
19852+
selectionDirection: SelectionDirection;
1985319853
/**
1985419854
* The **`selectionEnd`** property of the HTMLTextAreaElement interface specifies the end position of the current text selection in a <textarea> element. It is a number representing the last index of the selected text. It can be used to both retrieve and set the index of the end of a <textarea>s selected text.
1985519855
*
@@ -19940,7 +19940,7 @@ interface HTMLTextAreaElement extends HTMLElement {
1994019940
*
1994119941
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/setSelectionRange)
1994219942
*/
19943-
setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void;
19943+
setSelectionRange(start: number | null, end: number | null, direction?: SelectionDirection): void;
1994419944
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1994519945
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1994619946
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;

baselines/ts5.9/dom.generated.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19849,7 +19849,7 @@ interface HTMLTextAreaElement extends HTMLElement {
1984919849
*
1985019850
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/selectionDirection)
1985119851
*/
19852-
selectionDirection: "forward" | "backward" | "none";
19852+
selectionDirection: SelectionDirection;
1985319853
/**
1985419854
* The **`selectionEnd`** property of the HTMLTextAreaElement interface specifies the end position of the current text selection in a <textarea> element. It is a number representing the last index of the selected text. It can be used to both retrieve and set the index of the end of a <textarea>s selected text.
1985519855
*
@@ -19940,7 +19940,7 @@ interface HTMLTextAreaElement extends HTMLElement {
1994019940
*
1994119941
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/setSelectionRange)
1994219942
*/
19943-
setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void;
19943+
setSelectionRange(start: number | null, end: number | null, direction?: SelectionDirection): void;
1994419944
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1994519945
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1994619946
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;

inputfiles/overridingTypes.jsonc

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,48 +1442,6 @@
14421442
}
14431443
}
14441444
},
1445-
"HTMLTextAreaElement": {
1446-
"properties": {
1447-
"property": {
1448-
"autocomplete": {
1449-
"name": "autocomplete",
1450-
"overrideType": "AutoFill"
1451-
},
1452-
"labels": {
1453-
"name": "labels",
1454-
"overrideType": "NodeListOf<HTMLLabelElement>"
1455-
},
1456-
"selectionDirection": {
1457-
"name": "selectionDirection",
1458-
"overrideType": "\"forward\" | \"backward\" | \"none\""
1459-
}
1460-
}
1461-
},
1462-
"methods": {
1463-
"method": {
1464-
"setSelectionRange": {
1465-
"signature": {
1466-
"0": {
1467-
"param": [
1468-
{
1469-
"name": "start",
1470-
"nullable": true
1471-
},
1472-
{
1473-
"name": "end",
1474-
"nullable": true
1475-
},
1476-
{
1477-
"name": "direction",
1478-
"overrideType": "\"forward\" | \"backward\" | \"none\""
1479-
}
1480-
]
1481-
}
1482-
}
1483-
}
1484-
}
1485-
}
1486-
},
14871445
"ServiceWorkerContainer": {
14881446
"methods": {
14891447
"method": {

inputfiles/patches/html.kdl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,26 @@ interface HTMLInputElement {
9393
}
9494
}
9595

96+
interface HTMLTextAreaElement {
97+
property autocomplete type=AutoFill
98+
property labels {
99+
type NodeListOf {
100+
type HTMLLabelElement
101+
}
102+
}
103+
property selectionDirection type=SelectionDirection
104+
method setSelectionRange signatureIndex=0 {
105+
// Same as in HTMLInputElement
106+
param start {
107+
type nullable=#true
108+
}
109+
param end {
110+
type nullable=#true
111+
}
112+
param direction type=SelectionDirection
113+
}
114+
}
115+
96116
typedef SelectionDirection overrideType=#""forward" | "backward" | "none""#
97117

98118
dictionary StructuredSerializeOptions {

0 commit comments

Comments
 (0)