diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index a606f0991..2555232f5 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -17341,7 +17341,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/selectionDirection) */ - selectionDirection: "forward" | "backward" | "none" | null; + selectionDirection: Directions | null; /** * The **`selectionEnd`** property of the HTMLInputElement interface is a number that represents the end index of the selected text. That is, it represents the index of the character immediately following the selection. Likewise, when there is no selection, this returns the offset of the character immediately following the current text input cursor position. * @@ -17470,7 +17470,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/setSelectionRange) */ - setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void; + setSelectionRange(start: number | null, end: number | null, direction?: Directions): void; /** * The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element. * @@ -42434,6 +42434,7 @@ type ConstrainDouble = number | ConstrainDoubleRange; type ConstrainULong = number | ConstrainULongRange; type CookieList = CookieListItem[]; type DOMHighResTimeStamp = number; +type Directions = "forward" | "backward" | "none"; type EpochTimeStamp = number; type EventListenerOrEventListenerObject = EventListener | EventListenerObject; type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams; diff --git a/baselines/ts5.5/dom.generated.d.ts b/baselines/ts5.5/dom.generated.d.ts index 6b1ce43d3..d8b316670 100644 --- a/baselines/ts5.5/dom.generated.d.ts +++ b/baselines/ts5.5/dom.generated.d.ts @@ -17323,7 +17323,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/selectionDirection) */ - selectionDirection: "forward" | "backward" | "none" | null; + selectionDirection: Directions | null; /** * The **`selectionEnd`** property of the HTMLInputElement interface is a number that represents the end index of the selected text. That is, it represents the index of the character immediately following the selection. Likewise, when there is no selection, this returns the offset of the character immediately following the current text input cursor position. * @@ -17452,7 +17452,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/setSelectionRange) */ - setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void; + setSelectionRange(start: number | null, end: number | null, direction?: Directions): void; /** * The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element. * @@ -42408,6 +42408,7 @@ type ConstrainDouble = number | ConstrainDoubleRange; type ConstrainULong = number | ConstrainULongRange; type CookieList = CookieListItem[]; type DOMHighResTimeStamp = number; +type Directions = "forward" | "backward" | "none"; type EpochTimeStamp = number; type EventListenerOrEventListenerObject = EventListener | EventListenerObject; type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams; diff --git a/baselines/ts5.6/dom.generated.d.ts b/baselines/ts5.6/dom.generated.d.ts index e02807e16..b4f1bed31 100644 --- a/baselines/ts5.6/dom.generated.d.ts +++ b/baselines/ts5.6/dom.generated.d.ts @@ -17338,7 +17338,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/selectionDirection) */ - selectionDirection: "forward" | "backward" | "none" | null; + selectionDirection: Directions | null; /** * The **`selectionEnd`** property of the HTMLInputElement interface is a number that represents the end index of the selected text. That is, it represents the index of the character immediately following the selection. Likewise, when there is no selection, this returns the offset of the character immediately following the current text input cursor position. * @@ -17467,7 +17467,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/setSelectionRange) */ - setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void; + setSelectionRange(start: number | null, end: number | null, direction?: Directions): void; /** * The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element. * @@ -42431,6 +42431,7 @@ type ConstrainDouble = number | ConstrainDoubleRange; type ConstrainULong = number | ConstrainULongRange; type CookieList = CookieListItem[]; type DOMHighResTimeStamp = number; +type Directions = "forward" | "backward" | "none"; type EpochTimeStamp = number; type EventListenerOrEventListenerObject = EventListener | EventListenerObject; type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams; diff --git a/baselines/ts5.9/dom.generated.d.ts b/baselines/ts5.9/dom.generated.d.ts index ad1f341d2..b5817a16f 100644 --- a/baselines/ts5.9/dom.generated.d.ts +++ b/baselines/ts5.9/dom.generated.d.ts @@ -17338,7 +17338,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/selectionDirection) */ - selectionDirection: "forward" | "backward" | "none" | null; + selectionDirection: Directions | null; /** * The **`selectionEnd`** property of the HTMLInputElement interface is a number that represents the end index of the selected text. That is, it represents the index of the character immediately following the selection. Likewise, when there is no selection, this returns the offset of the character immediately following the current text input cursor position. * @@ -17467,7 +17467,7 @@ interface HTMLInputElement extends HTMLElement, PopoverTargetAttributes { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/setSelectionRange) */ - setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void; + setSelectionRange(start: number | null, end: number | null, direction?: Directions): void; /** * The **`HTMLInputElement.showPicker()`** method displays the browser picker for an input element. * @@ -42431,6 +42431,7 @@ type ConstrainDouble = number | ConstrainDoubleRange; type ConstrainULong = number | ConstrainULongRange; type CookieList = CookieListItem[]; type DOMHighResTimeStamp = number; +type Directions = "forward" | "backward" | "none"; type EpochTimeStamp = number; type EventListenerOrEventListenerObject = EventListener | EventListenerObject; type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams; diff --git a/inputfiles/addedTypes.jsonc b/inputfiles/addedTypes.jsonc index e377c9546..baf54fa5b 100644 --- a/inputfiles/addedTypes.jsonc +++ b/inputfiles/addedTypes.jsonc @@ -305,15 +305,6 @@ "name": "IDBOpenDBRequest", "extends": "IDBRequest" }, - "HTMLInputElement": { - "properties": { - "property": { - "labels": { - "overrideType": "NodeListOf" - } - } - } - }, // The spec removed `timestamp` but browsers still have it. // https://github.com/w3c/webrtc-encoded-transform/pull/204 "RTCEncodedAudioFrame": { @@ -606,6 +597,10 @@ // Full spec at https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill. "name": "AutoFill", "overrideType": "AutoFillBase | `${OptionalPrefixToken}${OptionalPrefixToken}${AutoFillField}${OptionalPostfixToken}`" + }, + { + "name": "Directions", + "overrideType": "\"forward\" | \"backward\" | \"none\"" } ] } diff --git a/inputfiles/knownTypes.json b/inputfiles/knownTypes.json index df1b8cda5..a16e077ba 100644 --- a/inputfiles/knownTypes.json +++ b/inputfiles/knownTypes.json @@ -14,7 +14,6 @@ "AutoFillContactField", "AutoFillField", "AutoFillCredentialField", - "AutoFill", "BigInteger", "ClientQueryOptions", "ClientTypes", diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index af2258aa5..1e86d1786 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -1445,48 +1445,6 @@ } } }, - "HTMLInputElement": { - "properties": { - "property": { - "autocomplete": { - "name": "autocomplete", - "overrideType": "AutoFill" - }, - "selectionDirection": { - "name": "selectionDirection", - "overrideType": "\"forward\" | \"backward\" | \"none\"" - }, - "valueAsDate": { - "name": "valueAsDate", - "overrideType": "Date" - } - } - }, - "methods": { - "method": { - "setSelectionRange": { - "signature": { - "0": { - "param": [ - { - "name": "start", - "nullable": true - }, - { - "name": "end", - "nullable": true - }, - { - "name": "direction", - "overrideType": "\"forward\" | \"backward\" | \"none\"" - } - ] - } - } - } - } - } - }, "MouseEvent": { "methods": { "method": { diff --git a/inputfiles/patches/html.kdl b/inputfiles/patches/html.kdl index edb9f0ed5..6be255e0d 100644 --- a/inputfiles/patches/html.kdl +++ b/inputfiles/patches/html.kdl @@ -47,6 +47,22 @@ interface HTMLImageElement { property loading overrideType=#""eager" | "lazy""# } +interface HTMLInputElement { + property labels { + type NodeListOf { + type HTMLLabelElement + } + } + property autocomplete type=AutoFill + property valueAsDate type=Date + property selectionDirection type=Directions + method setSelectionRange signatureIndex=0 { + param start nullable=#true + param end nullable=#true + param direction type=Directions + } +} + dictionary StructuredSerializeOptions { member transfer { type { diff --git a/src/build/patches.ts b/src/build/patches.ts index a2515c73f..4f20c59d8 100644 --- a/src/build/patches.ts +++ b/src/build/patches.ts @@ -320,6 +320,7 @@ function handleParam(node: Node) { name, ...optionalMember("type", "string", node.properties?.type), ...optionalMember("overrideType", "string", node.properties?.overrideType), + ...optionalMember("nullable", "boolean", node.properties?.nullable), additionalTypes, }; }