@@ -24,11 +24,15 @@ type MakeUnionsArray<T extends object> = {
24
24
* Attribute names must be written in the order listed in the HTML specification.
25
25
*/
26
26
27
+ // TODO: Give HTMLElement to the attribute that specifies the id of the dependent element, and automatically extracts the id
28
+
27
29
type CommonHTMLAttributes = { // use ABC order
28
30
/** @see https://html.spec.whatwg.org/#blocking-attribute */
29
31
blocking : "render"
30
32
/** @see https://html.spec.whatwg.org/#cors-settings-attribute */
31
33
crossorigin : "anonymous" | "" | "use-credentials"
34
+ /** @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time#valid_datetime_values */
35
+ datetime : string
32
36
/** @see https://html.spec.whatwg.org/#fetch-priority-attribute */
33
37
fetchpriority : "high" | "low" | "auto"
34
38
/** @see https://html.spec.whatwg.org/#hyperlink */
@@ -44,16 +48,17 @@ type CommonHTMLAttributes = { // use ABC order
44
48
} >
45
49
/** @see https://drafts.csswg.org/mediaqueries/ @see https://html.spec.whatwg.org/#mq */
46
50
media : string // TODO: union
51
+ ping : string // TODO: Allow array and URL
47
52
/** MIME type */
48
53
type : string
49
54
referrerpolicy : "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url"
50
55
/** @see https://html.spec.whatwg.org/#sizes-attribute */
51
56
sizes : string // TODO: type
57
+ src : string | URL
52
58
/** @see https://html.spec.whatwg.org/#srcset-attribute */
53
59
srcset : string // TODO: type
54
60
/** @see https://html.spec.whatwg.org/#navigable-target-names */
55
61
target : "_blank" | "_self" | "_parent" | "_top"
56
- | "_unfencedTop" // Non-standard
57
62
}
58
63
59
64
// based on HTML Living Standard (March 6, 2025)
@@ -109,14 +114,25 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
109
114
// attributionsrc: string // Experimental
110
115
href : CommonHTMLAttributes [ "href" ]
111
116
target : CommonHTMLAttributes [ "target" ]
117
+ | "_unfencedTop" // Non-standard
112
118
download : string | boolean
113
- ping : string // TODO: Allow array and URL
119
+ ping : CommonHTMLAttributes [ "ping" ]
114
120
rel : CommonHTMLAttributes [ "linkTypes" ] [ "a_area" ] | string
115
121
hreflang : CommonHTMLAttributes [ "lang" ]
116
122
type : CommonHTMLAttributes [ "type" ]
117
123
referrerpolicy : CommonHTMLAttributes [ "referrerpolicy" ]
118
124
}
119
- area : { }
125
+ area : {
126
+ alt : string
127
+ coords : string
128
+ shape : "circle" | "circ" | "default" | "poly" | "polygon" | "rect" | "rectangle"
129
+ href : CommonHTMLAttributes [ "href" ]
130
+ target : CommonHTMLAttributes [ "target" ]
131
+ download : string
132
+ ping : CommonHTMLAttributes [ "ping" ]
133
+ rel : CommonHTMLAttributes [ "linkTypes" ] [ "a_area" ]
134
+ referrerpolicy : CommonHTMLAttributes [ "referrerpolicy" ]
135
+ }
120
136
audio : { }
121
137
base : {
122
138
href : CommonHTMLAttributes [ "href" ]
@@ -137,18 +153,43 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
137
153
colgroup : {
138
154
span : number
139
155
}
140
- data : { }
141
- del : { }
142
- details : { }
143
- dialog : { }
144
- embed : { }
145
- fieldset : { }
156
+ data : {
157
+ value : string
158
+ }
159
+ del : {
160
+ cite : string
161
+ datetime : CommonHTMLAttributes [ "datetime" ]
162
+ }
163
+ details : {
164
+ name : string
165
+ open : boolean
166
+ }
167
+ dialog : {
168
+ closedby : "any" | "closerequest" | "none"
169
+ open : boolean
170
+ }
171
+ embed : {
172
+ src : CommonHTMLAttributes [ "src" ]
173
+ type : CommonHTMLAttributes [ "type" ]
174
+ width : number
175
+ height : number
176
+ }
177
+ fieldset : {
178
+ disabled : boolean
179
+ form : string // a form element
180
+ name : string
181
+ }
146
182
form : { }
147
183
iframe : { }
148
184
img : { }
149
185
input : { }
150
- ins : { }
151
- label : { }
186
+ ins : {
187
+ cite : string
188
+ datetime : CommonHTMLAttributes [ "datetime" ]
189
+ }
190
+ label : {
191
+ for : string
192
+ }
152
193
li : { }
153
194
link : {
154
195
href : CommonHTMLAttributes [ "href" ]
@@ -170,15 +211,43 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
170
211
disabled : boolean
171
212
fetchpriority : CommonHTMLAttributes [ "fetchpriority" ]
172
213
}
173
- map : { }
214
+ map : {
215
+ name : string
216
+ }
174
217
meta : { }
175
- meter : { }
218
+ meter : {
219
+ value : number
220
+ min : number
221
+ max : number
222
+ low : number
223
+ high : number
224
+ optimum : number
225
+ }
176
226
object : { }
177
- ol : { }
178
- optgroup : { }
179
- option : { }
180
- output : { }
181
- progress : { }
227
+ ol : {
228
+ reversed : boolean
229
+ start : number
230
+ type : "1" | "a" | "A" | "i" | "I"
231
+ }
232
+ optgroup : {
233
+ disabled : boolean
234
+ label : string
235
+ }
236
+ option : {
237
+ disabled : boolean
238
+ label : string
239
+ selected : boolean
240
+ value : string
241
+ }
242
+ output : {
243
+ for : Array < string > | string
244
+ form : string // a form element
245
+ name : string
246
+ }
247
+ progress : {
248
+ value : number
249
+ max : number
250
+ }
182
251
q : {
183
252
cite : string
184
253
}
@@ -190,11 +259,34 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
190
259
}
191
260
source : { }
192
261
style : { }
193
- td : { }
194
- template : { }
262
+ td : {
263
+ colspan : number
264
+ rowspan : number
265
+ headers : string
266
+ }
267
+ template : {
268
+ shadowrootmode : "open" | "closed"
269
+ shadowrootdelegatesfocus : boolean
270
+ shadowrootclonable : boolean
271
+ shadowrootserializable : boolean
272
+ }
195
273
textarea : { }
196
- th : { }
197
- time : { }
198
- track : { }
274
+ th : {
275
+ colspan : number
276
+ rowspan : number
277
+ headers : string
278
+ scope : "row" | "col" | "rowgroup" | "colgroup"
279
+ abbr : string
280
+ }
281
+ time : {
282
+ datetime : CommonHTMLAttributes [ "datetime" ]
283
+ }
284
+ track : {
285
+ kind : "subtitles" | "captions" | "descriptions" | "chapters" | "metadata"
286
+ src : CommonHTMLAttributes [ "src" ]
287
+ srclang : CommonHTMLAttributes [ "lang" ]
288
+ label : string
289
+ default : boolean
290
+ }
199
291
video : { }
200
292
} >
0 commit comments