Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions inputfiles/overridingTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -536,60 +536,6 @@
]
}
}
},
"properties": {
"property": {
"defaultView": {
"name": "defaultView",
"overrideType": "WindowProxy & typeof globalThis"
},
"documentElement": {
"name": "documentElement",
"overrideType": "HTMLElement",
"nullable": false
},
"head": {
"nullable": false
},
"anchors": {
"name": "anchors",
"overrideType": "HTMLCollectionOf<HTMLAnchorElement>"
},
"embeds": {
"name": "embeds",
"overrideType": "HTMLCollectionOf<HTMLEmbedElement>"
},
"forms": {
"name": "forms",
"overrideType": "HTMLCollectionOf<HTMLFormElement>"
},
"images": {
"name": "images",
"overrideType": "HTMLCollectionOf<HTMLImageElement>"
},
"links": {
"name": "links",
"overrideType": "HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement>"
},
"plugins": {
"name": "plugins",
"overrideType": "HTMLCollectionOf<HTMLEmbedElement>"
},
"scripts": {
"name": "scripts",
"overrideType": "HTMLCollectionOf<HTMLScriptElement>"
},
"location": {
// Pre-TS-5.1 hack to make document.location assignable
"readonly": false,
// Technically this can be null for a detached iframe.
// But that's an edge case and flipping this also breaks compatibility.
"nullable": false
},
"body": {
"nullable": false
}
}
}
},
"DocumentFragment": {
Expand Down
6 changes: 6 additions & 0 deletions inputfiles/patches/dom.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ interface EventListenerObject noInterfaceObject=#true {
}
}

interface Document {
property documentElement {
type HTMLElement nullable=#false
}
}

enum InsertPosition {
beforebegin
beforeend
Expand Down
60 changes: 60 additions & 0 deletions inputfiles/patches/html.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,66 @@ dictionary StructuredSerializeOptions {
}
}

// https://html.spec.whatwg.org/multipage/dom.html#the-document-object
interface Document {
// Pre-TS-5.1 hack to make document.location assignable
property location readonly=#false {
// Technically this can be null for a detached iframe.
// But that's an edge case and flipping this also breaks compatibility.
type nullable=#false
}

// Similarly body and head are mostly non-null for HTML documents.
// body can frequently be null when executing scripts in head, but flipping
// it also breaks compatibiliity.
property body {
type nullable=#false
}
property head {
type nullable=#false
}

// More specific types for HTMLCollection properties
property anchors {
type HTMLCollectionOf {
type HTMLAnchorElement
}
}
property embeds {
type HTMLCollectionOf {
type HTMLEmbedElement
}
}
property forms {
type HTMLCollectionOf {
type HTMLFormElement
}
}
property images {
type HTMLCollectionOf {
type HTMLImageElement
}
}
property links {
type HTMLCollectionOf {
type HTMLAnchorElement
type HTMLAreaElement
}
}
property plugins {
type HTMLCollectionOf {
type HTMLEmbedElement
}
}
property scripts {
type HTMLCollectionOf {
type HTMLScriptElement
}
}

property defaultView overrideType="WindowProxy & typeof globalThis"
}

removals {
dictionary CanvasRenderingContext2DSettings {
member colorType // Blink-only as of 2025-12, being tested in WebKit
Expand Down