Skip to content

Revert the DOM query changes #42230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 6, 2021
Merged
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
20 changes: 8 additions & 12 deletions src/lib/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ interface ImageEncodeOptions {
}

interface ImportMeta {
url?: string;
url: string;
}

interface InputEventInit extends UIEventInit {
Expand Down Expand Up @@ -4830,11 +4830,11 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad
* Returns a reference to the first object with the specified value of the ID attribute.
* @param elementId String that specifies the ID value.
*/
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
getElementById(elementId: string): HTMLElement | null;
/**
* 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.
*/
getElementsByClassName<E extends Element = HTMLElement>(classNames: string): HTMLCollectionOf<E>;
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
/**
* Gets a collection of objects based on the value of the NAME or ID attribute.
* @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.
Expand Down Expand Up @@ -5030,7 +5030,7 @@ interface DocumentEvent {
/** 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. */
interface DocumentFragment extends Node, NonElementParentNode, ParentNode {
readonly ownerDocument: Document;
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
getElementById(elementId: string): HTMLElement | null;
}

declare var DocumentFragment: {
Expand Down Expand Up @@ -5216,7 +5216,7 @@ interface Element extends Node, Animatable, ChildNode, InnerHTML, NonDocumentTyp
/**
* 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.
*/
getElementsByClassName<E extends Element = HTMLElement>(classNames: string): HTMLCollectionOf<E>;
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
Expand Down Expand Up @@ -6671,7 +6671,6 @@ interface HTMLElement extends Element, DocumentAndElementEventHandlers, ElementC
readonly offsetParent: Element | null;
readonly offsetTop: number;
readonly offsetWidth: number;
readonly parentElement: HTMLElement | null;
spellcheck: boolean;
title: string;
translate: boolean;
Expand Down Expand Up @@ -10865,7 +10864,7 @@ interface Node extends EventTarget {
/**
* Returns the parent element.
*/
readonly parentElement: Element | null;
readonly parentElement: HTMLElement | null;
/**
* Returns the parent.
*/
Expand Down Expand Up @@ -11123,7 +11122,7 @@ interface NonElementParentNode {
/**
* Returns the first element within node's descendants whose ID is elementId.
*/
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
getElementById(elementId: string): Element | null;
}

interface NotificationEventMap {
Expand Down Expand Up @@ -13052,9 +13051,7 @@ interface SVGElement extends Element, DocumentAndElementEventHandlers, DocumentA
/** @deprecated */
readonly className: any;
readonly ownerSVGElement: SVGSVGElement | null;
readonly parentElement: SVGElement | null;
readonly viewportElement: SVGElement | null;
getElementsByClassName<E extends Element = SVGElement>(classNames: string): HTMLCollectionOf<E>;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
Expand Down Expand Up @@ -13642,7 +13639,6 @@ interface SVGForeignObjectElement extends SVGGraphicsElement {
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
getElementsByClassName<E extends Element = HTMLElement>(classNames: string): HTMLCollectionOf<E>;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGForeignObjectElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGForeignObjectElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
Expand Down Expand Up @@ -14446,7 +14442,7 @@ interface SVGSVGElement extends SVGGraphicsElement, DocumentEvent, SVGFitToViewB
forceRedraw(): void;
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
getCurrentTime(): number;
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
getElementById(elementId: string): Element;
getEnclosureList(rect: SVGRect, referenceElement: SVGElement | null): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
getIntersectionList(rect: SVGRect, referenceElement: SVGElement | null): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
pauseAnimations(): void;
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/copyrightWithNewLine1.types
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import model = require("./greeter")
var el = document.getElementById('content');
>el : HTMLElement
>document.getElementById('content') : HTMLElement
>document.getElementById : <E extends Element = HTMLElement>(elementId: string) => E
>document.getElementById : (elementId: string) => HTMLElement
>document : Document
>getElementById : <E extends Element = HTMLElement>(elementId: string) => E
>getElementById : (elementId: string) => HTMLElement
>'content' : "content"

var greeter = new model.Greeter(el);
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/copyrightWithoutNewLine1.types
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import model = require("./greeter")
var el = document.getElementById('content');
>el : HTMLElement
>document.getElementById('content') : HTMLElement
>document.getElementById : <E extends Element = HTMLElement>(elementId: string) => E
>document.getElementById : (elementId: string) => HTMLElement
>document : Document
>getElementById : <E extends Element = HTMLElement>(elementId: string) => E
>getElementById : (elementId: string) => HTMLElement
>'content' : "content"

var greeter = new model.Greeter(el);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ declare var document: Document;

interface Document {
getElementById(elementId: string): HTMLElement;
>getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
>getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
>elementId : string
}

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

return document.getElementById(name);
>document.getElementById(name) : HTMLElement
>document.getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
>document.getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
>document : Document
>getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
>getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
>name : string

});
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/intersectionsOfLargeUnions.types
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export function assertNodeProperty<
>tagName : T

node[prop];
>node[prop] : ((null & ElementTagNameMap[T]) | (Node & ElementTagNameMap[T]))[P]
>node : (null & ElementTagNameMap[T]) | (Node & ElementTagNameMap[T])
>node[prop] : ElementTagNameMap[T][P]
>node : ElementTagNameMap[T]
>prop : P
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tests/cases/compiler/intersectionsOfLargeUnions2.ts(31,15): error TS2536: Type '
interface ElementTagNameMap {
~~~~~~~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'ElementTagNameMap'.
!!! related TS6203 /.ts/lib.dom.d.ts:19590:6: 'ElementTagNameMap' was also declared here.
!!! related TS6203 /.ts/lib.dom.d.ts:19586:6: 'ElementTagNameMap' was also declared here.
[index: number]: HTMLElement
}

Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/intersectionsOfLargeUnions2.types
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export function assertNodeProperty<
>tagName : T

node[prop];
>node[prop] : ((null & ElementTagNameMap[T]) | (Node & ElementTagNameMap[T]))[P]
>node : (null & ElementTagNameMap[T]) | (Node & ElementTagNameMap[T])
>node[prop] : ElementTagNameMap[T][P]
>node : ElementTagNameMap[T]
>prop : P
}
}
Expand Down
12 changes: 6 additions & 6 deletions tests/baselines/reference/mappedTypeRecursiveInference.types

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ declare var document: Document;

interface Document {
getElementById(elementId: string): HTMLElement;
>getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
>getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
>elementId : string
}
interface HTMLElement {
Expand All @@ -26,9 +26,9 @@ function getMaxWidth(elementNames: string[]) {

return document.getElementById(name);
>document.getElementById(name) : HTMLElement
>document.getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
>document.getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
>document : Document
>getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
>getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
>name : string

});
Expand Down