@@ -30,17 +30,20 @@ type MakeUnionsArray<T extends object> = {
30
30
// TODO: Give HTMLElement to the attribute that specifies the id of the dependent element, and automatically extracts the id
31
31
32
32
type CommonHTMLAttributes = { // use ABC order
33
+ autocomplete : "on" | "off" | ( string & { } ) | Array < string >
33
34
/** @see https://html.spec.whatwg.org/#blocking-attribute */
34
35
blocking : "render"
35
36
/** @see https://html.spec.whatwg.org/#cors-settings-attribute */
36
- crossorigin : "anonymous" | "" | "use-credentials"
37
+ cors : "anonymous" | "" | "use-credentials"
37
38
/** @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time#valid_datetime_values */
38
39
datetime : string
39
40
/** @see https://html.spec.whatwg.org/#fetch-priority-attribute */
40
41
fetchpriority : "high" | "low" | "auto"
41
42
/** @see https://w3c.github.io/webappsec-subresource-integrity/ */
42
43
integrity : string
43
44
lang : string // TODO: Enumeration of all language codes?
45
+ /** @see https://html.spec.whatwg.org/#lazy-loading-attribute */
46
+ lazyloading : "lazy" | "eager"
44
47
/** @see https://html.spec.whatwg.org/#linkTypes */
45
48
linkTypes : MakeUnionsArray < {
46
49
link : "alternate" | "canonical" | "author" | "dns-prefetch" | "expect" | "help" | "icon" | "manifest" | "modulepreload" | "license" | "next" | "pingback" | "preconnect" | "prefetch" | "preload" | "prev" | "privacy-policy" | "search" | "stylesheet" | "terms-of-service"
@@ -49,6 +52,8 @@ type CommonHTMLAttributes = { // use ABC order
49
52
} >
50
53
/** @see https://drafts.csswg.org/mediaqueries/ @see https://html.spec.whatwg.org/#mq */
51
54
media : string // TODO: union
55
+ /** MIME type */
56
+ mime : string
52
57
ping : string // TODO: Allow array and URL
53
58
preload : "auto" | "" | "none" | "metadata"
54
59
referrerpolicy : "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url"
@@ -59,8 +64,6 @@ type CommonHTMLAttributes = { // use ABC order
59
64
srcset : string // TODO: type
60
65
/** @see https://html.spec.whatwg.org/#navigable-target-names */
61
66
target : "_blank" | "_self" | "_parent" | "_top"
62
- /** MIME type */
63
- type : string
64
67
/** @see https://html.spec.whatwg.org/#hyperlink */
65
68
url : string | URL
66
69
}
@@ -132,7 +135,7 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
132
135
ping : CommonHTMLAttributes [ "ping" ]
133
136
rel : CommonHTMLAttributes [ "linkTypes" ] [ "a_area" ] | string
134
137
hreflang : CommonHTMLAttributes [ "lang" ]
135
- type : CommonHTMLAttributes [ "type " ]
138
+ type : CommonHTMLAttributes [ "mime " ]
136
139
referrerpolicy : CommonHTMLAttributes [ "referrerpolicy" ]
137
140
}
138
141
area : {
@@ -148,7 +151,7 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
148
151
}
149
152
audio : {
150
153
src : CommonHTMLAttributes [ "url" ]
151
- crossorigin : CommonHTMLAttributes [ "crossorigin " ]
154
+ crossorigin : CommonHTMLAttributes [ "cors " ]
152
155
preload : CommonHTMLAttributes [ "preload" ]
153
156
autoplay : boolean
154
157
loop : boolean
@@ -162,7 +165,7 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
162
165
blockquote : {
163
166
cite : string
164
167
}
165
- body : { }
168
+ body : { } // generate from WindowEventHandlersEventMap
166
169
button : {
167
170
command : "toggle-popover" | "show-popover" | "hide-popover" | "close" | "show-modal" | `--${string } ` // Experimental
168
171
commandfor : string // Experimental
@@ -206,7 +209,7 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
206
209
}
207
210
embed : {
208
211
src : CommonHTMLAttributes [ "url" ]
209
- type : CommonHTMLAttributes [ "type " ]
212
+ type : CommonHTMLAttributes [ "mime " ]
210
213
width : number
211
214
height : number
212
215
}
@@ -226,8 +229,34 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
226
229
target : CommonHTMLAttributes [ "target" ]
227
230
rel : CommonHTMLAttributes [ "linkTypes" ] [ "form" ]
228
231
}
229
- iframe : { }
230
- img : { }
232
+ iframe : {
233
+ src : CommonHTMLAttributes [ "url" ]
234
+ srcdoc : string // TODO: add HTMLElement
235
+ name : string
236
+ sandbox : string | Array < "allow-downloads" | "allow-forms" | "allow-modals" | "allow-orientation-lock" | "allow-pointer-lock" | "allow-popups" | "allow-popups-to-escape-sandbox" | "allow-presentation" | "allow-same-origin" | "allow-scripts" | "allow-top-navigation" | "allow-top-navigation-by-user-activation" | "allow-top-navigation-to-custom-protocols" >
237
+ /** @see https://html.spec.whatwg.org/#attr-iframe-allow */
238
+ allow : string // TODO: union
239
+ allowfullscreen : boolean
240
+ width : number
241
+ height : number
242
+ referrerpolicy : CommonHTMLAttributes [ "referrerpolicy" ]
243
+ loading : CommonHTMLAttributes [ "lazyloading" ]
244
+ }
245
+ img : {
246
+ alt : string
247
+ src : CommonHTMLAttributes [ "url" ]
248
+ srcset : CommonHTMLAttributes [ "srcset" ]
249
+ sizes : CommonHTMLAttributes [ "sizes" ]
250
+ crossorigin : CommonHTMLAttributes [ "cors" ]
251
+ usemap : `#${string } ` // map element's id
252
+ ismap : boolean
253
+ width : number
254
+ height : number
255
+ referrerpolicy : CommonHTMLAttributes [ "referrerpolicy" ]
256
+ decoding : "sync" | "async" | "auto"
257
+ loading : CommonHTMLAttributes [ "lazyloading" ]
258
+ fetchpriority : CommonHTMLAttributes [ "fetchpriority" ]
259
+ }
231
260
input : { }
232
261
ins : {
233
262
cite : string
@@ -236,15 +265,19 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
236
265
label : {
237
266
for : string
238
267
}
239
- li : { }
268
+ li : {
269
+ value : number
270
+ // /** @deprecated */
271
+ // type: "1" | "a" | "A" | "i" | "I"
272
+ }
240
273
link : {
241
274
href : CommonHTMLAttributes [ "url" ]
242
- crossorigin : CommonHTMLAttributes [ "crossorigin " ]
275
+ crossorigin : CommonHTMLAttributes [ "cors " ]
243
276
rel : CommonHTMLAttributes [ "linkTypes" ] [ "link" ]
244
277
media : CommonHTMLAttributes [ "media" ]
245
278
integrity : CommonHTMLAttributes [ "integrity" ]
246
279
hreflang : CommonHTMLAttributes [ "lang" ]
247
- type : CommonHTMLAttributes [ "type " ]
280
+ type : CommonHTMLAttributes [ "mime " ]
248
281
referrerpolicy : CommonHTMLAttributes [ "referrerpolicy" ]
249
282
sizes : string // TODO: Type sizes="16x16 32x32 48x48"
250
283
imagesrcset : CommonHTMLAttributes [ "srcset" ]
@@ -302,7 +335,7 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
302
335
}
303
336
object : {
304
337
data : CommonHTMLAttributes [ "url" ]
305
- type : CommonHTMLAttributes [ "type " ]
338
+ type : CommonHTMLAttributes [ "mime " ]
306
339
name : string
307
340
form : string // form element
308
341
width : number
@@ -335,13 +368,43 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
335
368
q : {
336
369
cite : string
337
370
}
338
- script : { }
339
- select : { }
371
+ script : {
372
+ src : CommonHTMLAttributes [ "url" ]
373
+ type : CommonHTMLAttributes [ "mime" ]
374
+ nomodule : boolean
375
+ async : boolean
376
+ defer : boolean
377
+ crossorigin : CommonHTMLAttributes [ "cors" ]
378
+ integrity : CommonHTMLAttributes [ "integrity" ]
379
+ referrerpolicy : CommonHTMLAttributes [ "referrerpolicy" ]
380
+ blocking : CommonHTMLAttributes [ "blocking" ]
381
+ fetchpriority : CommonHTMLAttributes [ "fetchpriority" ]
382
+ }
383
+ select : {
384
+ autocomplete : CommonHTMLAttributes [ "autocomplete" ]
385
+ disabled : boolean
386
+ form : string // form element
387
+ multiple : boolean
388
+ name : string
389
+ required : boolean
390
+ size : number
391
+ }
340
392
slot : {
341
393
name : string
342
394
}
343
- source : { }
344
- style : { }
395
+ source : {
396
+ type : CommonHTMLAttributes [ "mime" ]
397
+ media : MediaQuery
398
+ src : CommonHTMLAttributes [ "url" ]
399
+ srcset : CommonHTMLAttributes [ "srcset" ]
400
+ sizes : CommonHTMLAttributes [ "sizes" ]
401
+ width : number
402
+ height : number
403
+ }
404
+ style : {
405
+ media : MediaQuery
406
+ blocking : CommonHTMLAttributes [ "blocking" ]
407
+ }
345
408
td : {
346
409
colspan : number
347
410
rowspan : number
@@ -373,7 +436,7 @@ export type HTMLElementAttributeMap = HTMLElementAttributeFactory<{
373
436
}
374
437
video : {
375
438
src : CommonHTMLAttributes [ "url" ]
376
- crossorigin : CommonHTMLAttributes [ "crossorigin " ]
439
+ crossorigin : CommonHTMLAttributes [ "cors " ]
377
440
poster : CommonHTMLAttributes [ "url" ]
378
441
preload : CommonHTMLAttributes [ "preload" ]
379
442
autoplay : boolean
0 commit comments