Skip to content

Commit c030afa

Browse files
committed
fix(dom): narrow ownerDocument in specific Node interfaces
1 parent 4a32410 commit c030afa

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

baselines/dom.generated.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,6 +2156,7 @@ interface Attr extends Node {
21562156
readonly localName: string;
21572157
readonly name: string;
21582158
readonly namespaceURI: string | null;
2159+
readonly ownerDocument: Document;
21592160
readonly ownerElement: Element | null;
21602161
readonly prefix: string | null;
21612162
readonly specified: boolean;
@@ -3592,6 +3593,7 @@ declare var ChannelSplitterNode: {
35923593
interface CharacterData extends Node, ChildNode, NonDocumentTypeChildNode {
35933594
data: string;
35943595
readonly length: number;
3596+
readonly ownerDocument: Document;
35953597
appendData(data: string): void;
35963598
deleteData(offset: number, count: number): void;
35973599
insertData(offset: number, data: string): void;
@@ -4699,6 +4701,7 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad
46994701
* Returns document's origin.
47004702
*/
47014703
readonly origin: string;
4704+
readonly ownerDocument: null;
47024705
/**
47034706
* Return an HTMLCollection of the embed elements in the Document.
47044707
*/
@@ -5122,6 +5125,7 @@ interface DocumentEvent {
51225125

51235126
/** A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made. */
51245127
interface DocumentFragment extends Node, NonElementParentNode, ParentNode {
5128+
readonly ownerDocument: Document;
51255129
getElementById(elementId: string): HTMLElement | null;
51265130
}
51275131

@@ -5160,6 +5164,7 @@ declare var DocumentTimeline: {
51605164
/** A Node containing a doctype. */
51615165
interface DocumentType extends Node, ChildNode {
51625166
readonly name: string;
5167+
readonly ownerDocument: Document;
51635168
readonly publicId: string;
51645169
readonly systemId: string;
51655170
}
@@ -5258,6 +5263,7 @@ interface Element extends Node, Animatable, ChildNode, InnerHTML, NonDocumentTyp
52585263
onfullscreenchange: ((this: Element, ev: Event) => any) | null;
52595264
onfullscreenerror: ((this: Element, ev: Event) => any) | null;
52605265
outerHTML: string;
5266+
readonly ownerDocument: Document;
52615267
/**
52625268
* Returns the namespace prefix.
52635269
*/
@@ -12026,6 +12032,7 @@ interface PositionError {
1202612032

1202712033
/** A processing instruction embeds application-specific instructions in XML which can be ignored by other applications that don't recognize them. */
1202812034
interface ProcessingInstruction extends CharacterData {
12035+
readonly ownerDocument: Document;
1202912036
readonly target: string;
1203012037
}
1203112038

inputfiles/addedTypes.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,11 @@
646646
"read-only": 1,
647647
"override-type": "HTMLSlotElement | null"
648648
},
649+
"ownerDocument": {
650+
"name": "ownerDocument",
651+
"read-only": 1,
652+
"override-type": "Document"
653+
},
649654
"slot": {
650655
"name": "slot",
651656
"override-type": "string"
@@ -674,6 +679,15 @@
674679
"type": "Event"
675680
}
676681
]
682+
},
683+
"properties": {
684+
"property": {
685+
"ownerDocument": {
686+
"name": "ownerDocument",
687+
"read-only": 1,
688+
"override-type": "null"
689+
}
690+
}
677691
}
678692
},
679693
"Navigator": {
@@ -1000,6 +1014,15 @@
10001014
]
10011015
}
10021016
}
1017+
},
1018+
"properties": {
1019+
"property": {
1020+
"ownerDocument": {
1021+
"name": "ownerDocument",
1022+
"read-only": 1,
1023+
"override-type": "Document"
1024+
}
1025+
}
10031026
}
10041027
},
10051028
"SpeechRecognition": {
@@ -2246,6 +2269,50 @@
22462269
}
22472270
]
22482271
}
2272+
},
2273+
"Attr": {
2274+
"properties": {
2275+
"property": {
2276+
"ownerDocument": {
2277+
"name": "ownerDocument",
2278+
"read-only": 1,
2279+
"override-type": "Document"
2280+
}
2281+
}
2282+
}
2283+
},
2284+
"CharacterData": {
2285+
"properties": {
2286+
"property": {
2287+
"ownerDocument": {
2288+
"name": "ownerDocument",
2289+
"read-only": 1,
2290+
"override-type": "Document"
2291+
}
2292+
}
2293+
}
2294+
},
2295+
"ProcessingInstruction": {
2296+
"properties": {
2297+
"property": {
2298+
"ownerDocument": {
2299+
"name": "ownerDocument",
2300+
"read-only": 1,
2301+
"override-type": "Document"
2302+
}
2303+
}
2304+
}
2305+
},
2306+
"DocumentType": {
2307+
"properties": {
2308+
"property": {
2309+
"ownerDocument": {
2310+
"name": "ownerDocument",
2311+
"read-only": 1,
2312+
"override-type": "Document"
2313+
}
2314+
}
2315+
}
22492316
}
22502317
}
22512318
},

0 commit comments

Comments
 (0)