Skip to content

Commit 5f409b5

Browse files
Orta TheroxZzzen
Orta Therox
authored andcommitted
Revert the DOM query changes (microsoft#42230)
* Revert the DOM query changes * Adds baselines * Hotfix for the removeal of the url nullabulity for testing
1 parent 222e304 commit 5f409b5

9 files changed

+29
-33
lines changed

src/lib/dom.generated.d.ts

+8-12
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ interface ImageEncodeOptions {
595595
}
596596

597597
interface ImportMeta {
598-
url?: string;
598+
url: string;
599599
}
600600

601601
interface InputEventInit extends UIEventInit {
@@ -4830,11 +4830,11 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad
48304830
* Returns a reference to the first object with the specified value of the ID attribute.
48314831
* @param elementId String that specifies the ID value.
48324832
*/
4833-
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
4833+
getElementById(elementId: string): HTMLElement | null;
48344834
/**
48354835
* Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes.
48364836
*/
4837-
getElementsByClassName<E extends Element = HTMLElement>(classNames: string): HTMLCollectionOf<E>;
4837+
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
48384838
/**
48394839
* Gets a collection of objects based on the value of the NAME or ID attribute.
48404840
* @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.
@@ -5030,7 +5030,7 @@ interface DocumentEvent {
50305030
/** 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. */
50315031
interface DocumentFragment extends Node, NonElementParentNode, ParentNode {
50325032
readonly ownerDocument: Document;
5033-
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
5033+
getElementById(elementId: string): HTMLElement | null;
50345034
}
50355035

50365036
declare var DocumentFragment: {
@@ -5216,7 +5216,7 @@ interface Element extends Node, Animatable, ChildNode, InnerHTML, NonDocumentTyp
52165216
/**
52175217
* Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes.
52185218
*/
5219-
getElementsByClassName<E extends Element = HTMLElement>(classNames: string): HTMLCollectionOf<E>;
5219+
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
52205220
getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
52215221
getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
52225222
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
@@ -6671,7 +6671,6 @@ interface HTMLElement extends Element, DocumentAndElementEventHandlers, ElementC
66716671
readonly offsetParent: Element | null;
66726672
readonly offsetTop: number;
66736673
readonly offsetWidth: number;
6674-
readonly parentElement: HTMLElement | null;
66756674
spellcheck: boolean;
66766675
title: string;
66776676
translate: boolean;
@@ -10865,7 +10864,7 @@ interface Node extends EventTarget {
1086510864
/**
1086610865
* Returns the parent element.
1086710866
*/
10868-
readonly parentElement: Element | null;
10867+
readonly parentElement: HTMLElement | null;
1086910868
/**
1087010869
* Returns the parent.
1087110870
*/
@@ -11123,7 +11122,7 @@ interface NonElementParentNode {
1112311122
/**
1112411123
* Returns the first element within node's descendants whose ID is elementId.
1112511124
*/
11126-
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
11125+
getElementById(elementId: string): Element | null;
1112711126
}
1112811127

1112911128
interface NotificationEventMap {
@@ -13052,9 +13051,7 @@ interface SVGElement extends Element, DocumentAndElementEventHandlers, DocumentA
1305213051
/** @deprecated */
1305313052
readonly className: any;
1305413053
readonly ownerSVGElement: SVGSVGElement | null;
13055-
readonly parentElement: SVGElement | null;
1305613054
readonly viewportElement: SVGElement | null;
13057-
getElementsByClassName<E extends Element = SVGElement>(classNames: string): HTMLCollectionOf<E>;
1305813055
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1305913056
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1306013057
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -13642,7 +13639,6 @@ interface SVGForeignObjectElement extends SVGGraphicsElement {
1364213639
readonly width: SVGAnimatedLength;
1364313640
readonly x: SVGAnimatedLength;
1364413641
readonly y: SVGAnimatedLength;
13645-
getElementsByClassName<E extends Element = HTMLElement>(classNames: string): HTMLCollectionOf<E>;
1364613642
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGForeignObjectElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1364713643
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1364813644
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGForeignObjectElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -14446,7 +14442,7 @@ interface SVGSVGElement extends SVGGraphicsElement, DocumentEvent, SVGFitToViewB
1444614442
forceRedraw(): void;
1444714443
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
1444814444
getCurrentTime(): number;
14449-
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
14445+
getElementById(elementId: string): Element;
1445014446
getEnclosureList(rect: SVGRect, referenceElement: SVGElement | null): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
1445114447
getIntersectionList(rect: SVGRect, referenceElement: SVGElement | null): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
1445214448
pauseAnimations(): void;

tests/baselines/reference/copyrightWithNewLine1.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import model = require("./greeter")
99
var el = document.getElementById('content');
1010
>el : HTMLElement
1111
>document.getElementById('content') : HTMLElement
12-
>document.getElementById : <E extends Element = HTMLElement>(elementId: string) => E
12+
>document.getElementById : (elementId: string) => HTMLElement
1313
>document : Document
14-
>getElementById : <E extends Element = HTMLElement>(elementId: string) => E
14+
>getElementById : (elementId: string) => HTMLElement
1515
>'content' : "content"
1616

1717
var greeter = new model.Greeter(el);

tests/baselines/reference/copyrightWithoutNewLine1.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import model = require("./greeter")
88
var el = document.getElementById('content');
99
>el : HTMLElement
1010
>document.getElementById('content') : HTMLElement
11-
>document.getElementById : <E extends Element = HTMLElement>(elementId: string) => E
11+
>document.getElementById : (elementId: string) => HTMLElement
1212
>document : Document
13-
>getElementById : <E extends Element = HTMLElement>(elementId: string) => E
13+
>getElementById : (elementId: string) => HTMLElement
1414
>'content' : "content"
1515

1616
var greeter = new model.Greeter(el);

tests/baselines/reference/genericMethodOverspecialization.types

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ declare var document: Document;
2121

2222
interface Document {
2323
getElementById(elementId: string): HTMLElement;
24-
>getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
24+
>getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
2525
>elementId : string
2626
}
2727

@@ -36,9 +36,9 @@ var elements = names.map(function (name) {
3636

3737
return document.getElementById(name);
3838
>document.getElementById(name) : HTMLElement
39-
>document.getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
39+
>document.getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
4040
>document : Document
41-
>getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
41+
>getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
4242
>name : string
4343

4444
});

tests/baselines/reference/intersectionsOfLargeUnions.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export function assertNodeProperty<
7474
>tagName : T
7575

7676
node[prop];
77-
>node[prop] : ((null & ElementTagNameMap[T]) | (Node & ElementTagNameMap[T]))[P]
78-
>node : (null & ElementTagNameMap[T]) | (Node & ElementTagNameMap[T])
77+
>node[prop] : ElementTagNameMap[T][P]
78+
>node : ElementTagNameMap[T]
7979
>prop : P
8080
}
8181
}

tests/baselines/reference/intersectionsOfLargeUnions2.errors.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ tests/cases/compiler/intersectionsOfLargeUnions2.ts(31,15): error TS2536: Type '
1010
interface ElementTagNameMap {
1111
~~~~~~~~~~~~~~~~~
1212
!!! error TS2300: Duplicate identifier 'ElementTagNameMap'.
13-
!!! related TS6203 /.ts/lib.dom.d.ts:19590:6: 'ElementTagNameMap' was also declared here.
13+
!!! related TS6203 /.ts/lib.dom.d.ts:19586:6: 'ElementTagNameMap' was also declared here.
1414
[index: number]: HTMLElement
1515
}
1616

tests/baselines/reference/intersectionsOfLargeUnions2.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ export function assertNodeProperty<
8888
>tagName : T
8989

9090
node[prop];
91-
>node[prop] : ((null & ElementTagNameMap[T]) | (Node & ElementTagNameMap[T]))[P]
92-
>node : (null & ElementTagNameMap[T]) | (Node & ElementTagNameMap[T])
91+
>node[prop] : ElementTagNameMap[T][P]
92+
>node : ElementTagNameMap[T]
9393
>prop : P
9494
}
9595
}

tests/baselines/reference/mappedTypeRecursiveInference.types

+6-6
Large diffs are not rendered by default.

tests/baselines/reference/unknownSymbolOffContextualType1.types

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ declare var document: Document;
44

55
interface Document {
66
getElementById(elementId: string): HTMLElement;
7-
>getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
7+
>getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
88
>elementId : string
99
}
1010
interface HTMLElement {
@@ -26,9 +26,9 @@ function getMaxWidth(elementNames: string[]) {
2626

2727
return document.getElementById(name);
2828
>document.getElementById(name) : HTMLElement
29-
>document.getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
29+
>document.getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
3030
>document : Document
31-
>getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
31+
>getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
3232
>name : string
3333

3434
});

0 commit comments

Comments
 (0)