Skip to content

Commit bff030e

Browse files
committed
Migrate Document element properties
1 parent a244dbd commit bff030e

File tree

2 files changed

+66
-47
lines changed

2 files changed

+66
-47
lines changed

inputfiles/overridingTypes.jsonc

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -542,53 +542,7 @@
542542
"defaultView": {
543543
"name": "defaultView",
544544
"overrideType": "WindowProxy & typeof globalThis"
545-
},
546-
"documentElement": {
547-
"name": "documentElement",
548-
"overrideType": "HTMLElement",
549-
"nullable": false
550-
},
551-
"head": {
552-
"nullable": false
553-
},
554-
"anchors": {
555-
"name": "anchors",
556-
"overrideType": "HTMLCollectionOf<HTMLAnchorElement>"
557-
},
558-
"embeds": {
559-
"name": "embeds",
560-
"overrideType": "HTMLCollectionOf<HTMLEmbedElement>"
561-
},
562-
"forms": {
563-
"name": "forms",
564-
"overrideType": "HTMLCollectionOf<HTMLFormElement>"
565-
},
566-
"images": {
567-
"name": "images",
568-
"overrideType": "HTMLCollectionOf<HTMLImageElement>"
569-
},
570-
"links": {
571-
"name": "links",
572-
"overrideType": "HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement>"
573-
},
574-
"plugins": {
575-
"name": "plugins",
576-
"overrideType": "HTMLCollectionOf<HTMLEmbedElement>"
577-
},
578-
"scripts": {
579-
"name": "scripts",
580-
"overrideType": "HTMLCollectionOf<HTMLScriptElement>"
581-
},
582-
"location": {
583-
// Pre-TS-5.1 hack to make document.location assignable
584-
"readonly": false,
585-
// Technically this can be null for a detached iframe.
586-
// But that's an edge case and flipping this also breaks compatibility.
587-
"nullable": false
588-
},
589-
"body": {
590-
"nullable": false
591-
}
545+
}
592546
}
593547
}
594548
},

inputfiles/patches/dom.kdl

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,71 @@ interface EventListenerObject noInterfaceObject=#true {
1111
}
1212
}
1313

14+
interface Document {
15+
property anchors nullable=#false {
16+
type HTMLCollectionOf {
17+
type HTMLAnchorElement
18+
}
19+
}
20+
21+
property body {
22+
type nullable=#false
23+
}
24+
25+
property documentElement {
26+
type HTMLElement nullable=#false
27+
}
28+
29+
property embeds nullable=#false {
30+
type HTMLCollectionOf {
31+
type HTMLEmbedElement
32+
}
33+
}
34+
35+
property forms nullable=#false {
36+
type HTMLCollectionOf {
37+
type HTMLFormElement
38+
}
39+
}
40+
41+
property head {
42+
type nullable=#false
43+
}
44+
45+
property images nullable=#false {
46+
type HTMLCollectionOf {
47+
type HTMLImageElement
48+
}
49+
}
50+
51+
property links nullable=#false {
52+
type HTMLCollectionOf {
53+
type HTMLAnchorElement
54+
type HTMLAreaElement
55+
}
56+
}
57+
58+
// Pre-TS-5.1 hack to make document.location assignable
59+
property location readonly=#false {
60+
// Technically this can be null for a detached iframe.
61+
// But that's an edge case and flipping this also breaks compatibility.
62+
type nullable=#false
63+
}
64+
65+
property plugins nullable=#false {
66+
type HTMLCollectionOf {
67+
type HTMLEmbedElement
68+
}
69+
}
70+
71+
property scripts nullable=#false {
72+
type HTMLCollectionOf {
73+
type HTMLScriptElement
74+
}
75+
}
76+
}
77+
78+
1479
enum InsertPosition {
1580
beforebegin
1681
beforeend

0 commit comments

Comments
 (0)