Skip to content

Commit 60070c2

Browse files
authored
Merge pull request #495 from saschanaz/image-maps
Add form/imagemap/table/input types
2 parents d937cbe + 99d27ed commit 60070c2

14 files changed

+358
-68
lines changed

baselines/dom.generated.d.ts

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5667,6 +5667,8 @@ interface HTMLAreaElement extends HTMLElement, HTMLHyperlinkElementUtils {
56675667
*/
56685668
/** @deprecated */
56695669
noHref: boolean;
5670+
ping: string;
5671+
referrerPolicy: string;
56705672
rel: string;
56715673
readonly relList: DOMTokenList;
56725674
/**
@@ -5688,14 +5690,6 @@ declare var HTMLAreaElement: {
56885690
new(): HTMLAreaElement;
56895691
};
56905692

5691-
interface HTMLAreasCollection extends HTMLCollectionBase {
5692-
}
5693-
5694-
declare var HTMLAreasCollection: {
5695-
prototype: HTMLAreasCollection;
5696-
new(): HTMLAreasCollection;
5697-
};
5698-
56995693
interface HTMLAudioElement extends HTMLMediaElement {
57005694
addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLAudioElement, ev: HTMLMediaElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
57015695
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -6421,16 +6415,6 @@ interface HTMLFormElement extends HTMLElement {
64216415
* Returns whether a form will validate when it is submitted, without having to submit it.
64226416
*/
64236417
checkValidity(): boolean;
6424-
/**
6425-
* Retrieves a form object or an object from an elements collection.
6426-
* @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.
6427-
* @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.
6428-
*/
6429-
item(name?: any, index?: any): any;
6430-
/**
6431-
* Retrieves a form object or an object from an elements collection.
6432-
*/
6433-
namedItem(name: string): any;
64346418
reportValidity(): boolean;
64356419
/**
64366420
* Fires when the user resets a form.
@@ -6444,7 +6428,7 @@ interface HTMLFormElement extends HTMLElement {
64446428
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
64456429
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLFormElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
64466430
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
6447-
[name: string]: any;
6431+
[index: number]: Element;
64486432
}
64496433

64506434
declare var HTMLFormElement: {
@@ -6840,6 +6824,7 @@ interface HTMLInputElement extends HTMLElement {
68406824
* Sets or retrieves the initial contents of the object.
68416825
*/
68426826
defaultValue: string;
6827+
dirName: string;
68436828
disabled: boolean;
68446829
/**
68456830
* Returns a FileList object on a file type input object.
@@ -6874,6 +6859,7 @@ interface HTMLInputElement extends HTMLElement {
68746859
*/
68756860
height: number;
68766861
indeterminate: boolean;
6862+
readonly labels: NodeListOf<HTMLLabelElement> | null;
68776863
/**
68786864
* Specifies the ID of a pre-defined datalist of options for an input element.
68796865
*/
@@ -6956,7 +6942,6 @@ interface HTMLInputElement extends HTMLElement {
69566942
* Returns the input field value as a number.
69576943
*/
69586944
valueAsNumber: number;
6959-
webkitdirectory: boolean;
69606945
/**
69616946
* Sets or retrieves the width of the object.
69626947
*/
@@ -6969,6 +6954,7 @@ interface HTMLInputElement extends HTMLElement {
69696954
* Returns whether a form will validate when it is submitted, without having to submit it.
69706955
*/
69716956
checkValidity(): boolean;
6957+
reportValidity(): boolean;
69726958
/**
69736959
* Makes the selection equal to the current object.
69746960
*/
@@ -6978,6 +6964,8 @@ interface HTMLInputElement extends HTMLElement {
69786964
* @param error Sets a custom error message that is displayed when a form is submitted.
69796965
*/
69806966
setCustomValidity(error: string): void;
6967+
setRangeText(replacement: string): void;
6968+
setRangeText(replacement: string, start: number, end: number, selectionMode?: SelectionMode): void;
69816969
/**
69826970
* Sets the start and end positions of a selection in a text field.
69836971
* @param start The offset into the text field for the start of the selection.
@@ -7025,7 +7013,7 @@ declare var HTMLLIElement: {
70257013
};
70267014

70277015
interface HTMLLabelElement extends HTMLElement {
7028-
readonly control: HTMLInputElement | null;
7016+
readonly control: HTMLElement | null;
70297017
/**
70307018
* Retrieves a reference to the form that the object is embedded in.
70317019
*/
@@ -7133,7 +7121,7 @@ interface HTMLMapElement extends HTMLElement {
71337121
/**
71347122
* Retrieves a collection of the area objects defined for the given map object.
71357123
*/
7136-
readonly areas: HTMLAreasCollection;
7124+
readonly areas: HTMLCollection;
71377125
/**
71387126
* Sets or retrieves the name of the object.
71397127
*/
@@ -8305,7 +8293,7 @@ interface HTMLTableElement extends HTMLElement {
83058293
* Removes the specified row (tr) from the element and from the rows collection.
83068294
* @param index Number that specifies the zero-based position in the rows collection of the row to remove.
83078295
*/
8308-
deleteRow(index?: number): void;
8296+
deleteRow(index: number): void;
83098297
/**
83108298
* Deletes the tFoot element and its contents from the table.
83118299
*/
@@ -8373,7 +8361,7 @@ interface HTMLTableRowElement extends HTMLElement {
83738361
* Removes the specified cell from the table row, as well as from the cells collection.
83748362
* @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted.
83758363
*/
8376-
deleteCell(index?: number): void;
8364+
deleteCell(index: number): void;
83778365
/**
83788366
* Creates a new cell in the table row, and adds the cell to the cells collection.
83798367
* @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection.
@@ -8410,7 +8398,7 @@ interface HTMLTableSectionElement extends HTMLElement {
84108398
* Removes the specified row (tr) from the element and from the rows collection.
84118399
* @param index Number that specifies the zero-based position in the rows collection of the row to remove.
84128400
*/
8413-
deleteRow(index?: number): void;
8401+
deleteRow(index: number): void;
84148402
/**
84158403
* Creates a new row (tr) in the table, and adds the row to the rows collection.
84168404
* @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.

baselines/dom.iterable.generated.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ interface HTMLCollectionOf<T extends Element> {
6969
[Symbol.iterator](): IterableIterator<T>;
7070
}
7171

72+
interface HTMLFormElement {
73+
[Symbol.iterator](): IterableIterator<Element>;
74+
}
75+
7276
interface HTMLSelectElement {
7377
[Symbol.iterator](): IterableIterator<Element>;
7478
}

inputfiles/addedTypes.json

Lines changed: 97 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -706,17 +706,6 @@
706706
"extends": "Array<IDBValidKey>",
707707
"no-interface-object": "1"
708708
},
709-
"HTMLInputElement": {
710-
"name": "HTMLInputElement",
711-
"properties": {
712-
"property": {
713-
"minLength": {
714-
"name": "minLength",
715-
"override-type": "number"
716-
}
717-
}
718-
}
719-
},
720709
"HTMLIFrameElement": {
721710
"name": "HTMLIFrameElement",
722711
"properties": {
@@ -1459,20 +1448,6 @@
14591448
}
14601449
}
14611450
},
1462-
"HTMLFormElement": {
1463-
"name": "HTMLFormElement",
1464-
"methods": {
1465-
"method": {
1466-
"reportValidity": {
1467-
"name": "reportValidity",
1468-
"exposed": "Window",
1469-
"override-signatures": [
1470-
"reportValidity(): boolean"
1471-
]
1472-
}
1473-
}
1474-
}
1475-
},
14761451
"OES_vertex_array_object": {
14771452
"name": "OES_vertex_array_object",
14781453
"exposed": "Window",
@@ -1965,18 +1940,6 @@
19651940
},
19661941
"no-interface-object": "1"
19671942
},
1968-
"HTMLLabelElement": {
1969-
"name": "HTMLLabelElement",
1970-
"properties": {
1971-
"property": {
1972-
"control": {
1973-
"name": "control",
1974-
"read-only": 1,
1975-
"override-type": "HTMLInputElement | null"
1976-
}
1977-
}
1978-
}
1979-
},
19801943
"HTMLObjectElement": {
19811944
"name": "HTMLObjectElement",
19821945
"properties": {
@@ -2066,6 +2029,13 @@
20662029
},
20672030
"no-interface-object": "1"
20682031
},
2032+
"HTMLAreaElement": {
2033+
"element": [
2034+
{
2035+
"name": "area"
2036+
}
2037+
]
2038+
},
20692039
"HTMLBaseElement": {
20702040
"element": [
20712041
{
@@ -2087,6 +2057,13 @@
20872057
}
20882058
]
20892059
},
2060+
"HTMLFormElement": {
2061+
"element": [
2062+
{
2063+
"name": "form"
2064+
}
2065+
]
2066+
},
20902067
"HTMLHeadElement": {
20912068
"element": [
20922069
{
@@ -2108,6 +2085,21 @@
21082085
}
21092086
]
21102087
},
2088+
"HTMLInputElement": {
2089+
"properties": {
2090+
"property": {
2091+
"labels": {
2092+
"override-type": "NodeListOf<HTMLLabelElement> | null"
2093+
}
2094+
}
2095+
},
2096+
"element": [
2097+
{
2098+
2099+
"name": "input"
2100+
}
2101+
]
2102+
},
21112103
"HTMLLinkElement": {
21122104
"properties": {
21132105
"property": {
@@ -2123,13 +2115,27 @@
21232115
}
21242116
]
21252117
},
2118+
"HTMLLabelElement": {
2119+
"element": [
2120+
{
2121+
"name": "label"
2122+
}
2123+
]
2124+
},
21262125
"HTMLLIElement": {
21272126
"element": [
21282127
{
21292128
"name": "li"
21302129
}
21312130
]
21322131
},
2132+
"HTMLMapElement": {
2133+
"element": [
2134+
{
2135+
"name": "map"
2136+
}
2137+
]
2138+
},
21332139
"HTMLMenuElement": {
21342140
"element": [
21352141
{
@@ -2190,6 +2196,33 @@
21902196
}
21912197
]
21922198
},
2199+
"HTMLTableCaptionElement": {
2200+
"element": [
2201+
{
2202+
"name": "caption"
2203+
}
2204+
]
2205+
},
2206+
"HTMLTableCellElement": {
2207+
"element": [
2208+
{
2209+
"name": "td"
2210+
},
2211+
{
2212+
"name": "th"
2213+
}
2214+
]
2215+
},
2216+
"HTMLTableColElement": {
2217+
"element": [
2218+
{
2219+
"name": "col"
2220+
},
2221+
{
2222+
"name": "colgroup"
2223+
}
2224+
]
2225+
},
21932226
"HTMLTableDataCellElement": {
21942227
"name": "HTMLTableDataCellElement",
21952228
"extends": "HTMLTableCellElement",
@@ -2202,6 +2235,13 @@
22022235
}
22032236
]
22042237
},
2238+
"HTMLTableElement": {
2239+
"element": [
2240+
{
2241+
"name": "table"
2242+
}
2243+
]
2244+
},
22052245
"HTMLTableHeaderCellElement": {
22062246
"name": "HTMLTableHeaderCellElement",
22072247
"extends": "HTMLTableCellElement",
@@ -2220,6 +2260,26 @@
22202260
}
22212261
]
22222262
},
2263+
"HTMLTableRowElement": {
2264+
"element": [
2265+
{
2266+
"name": "tr"
2267+
}
2268+
]
2269+
},
2270+
"HTMLTableSectionElement": {
2271+
"element": [
2272+
{
2273+
"name": "tbody"
2274+
},
2275+
{
2276+
"name": "tfoot"
2277+
},
2278+
{
2279+
"name": "thead"
2280+
}
2281+
]
2282+
},
22232283
"HTMLTitleElement": {
22242284
"element": [
22252285
{

inputfiles/comments.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,15 +1576,9 @@
15761576
"reset": {
15771577
"comment": "/**\r\n * Fires when the user resets a form.\r\n */"
15781578
},
1579-
"item": {
1580-
"comment": "/**\r\n * Retrieves a form object or an object from an elements collection.\r\n * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\r\n * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\r\n */"
1581-
},
15821579
"submit": {
15831580
"comment": "/**\r\n * Fires when a FORM is about to be submitted.\r\n */"
15841581
},
1585-
"namedItem": {
1586-
"comment": "/**\r\n * Retrieves a form object or an object from an elements collection.\r\n */"
1587-
},
15881582
"checkValidity": {
15891583
"comment": "/**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */"
15901584
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"form-elements": "Returns an HTMLFormControlsCollection of the form controls in the form (excluding image\nbuttons for historical reasons).",
3+
"form-length": "Returns the number of form controls in the form (excluding image buttons for historical\nreasons).",
4+
"form-submit": "Submits the form.",
5+
"form-reset": "Resets the form.",
6+
"form-checkvalidity": "Returns true if the form's controls are all valid; otherwise, returns false.",
7+
"form-reportvalidity": "Returns true if the form's controls are all valid; otherwise, returns false and informs the user.",
8+
"label-control": "Returns the form control that is associated with this element.",
9+
"label-form": "Returns the form owner of the form control that is associated with this\nelement.\nReturns null if there isn't one.",
10+
"lfe-labels": "Returns a NodeList of all the label elements that the form control\nis associated with."
11+
}

0 commit comments

Comments
 (0)