@@ -4803,11 +4803,11 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad
4803
4803
* Returns a reference to the first object with the specified value of the ID attribute.
4804
4804
* @param elementId String that specifies the ID value.
4805
4805
*/
4806
- getElementById(elementId: string): HTMLElement | null;
4806
+ getElementById<E extends Element = HTMLElement> (elementId: string): E | null;
4807
4807
/**
4808
4808
* 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.
4809
4809
*/
4810
- getElementsByClassName(classNames: string): HTMLCollectionOf<Element >;
4810
+ getElementsByClassName<E extends Element = HTMLElement> (classNames: string): HTMLCollectionOf<E >;
4811
4811
/**
4812
4812
* Gets a collection of objects based on the value of the NAME or ID attribute.
4813
4813
* @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.
@@ -5003,7 +5003,7 @@ interface DocumentEvent {
5003
5003
/** 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. */
5004
5004
interface DocumentFragment extends Node, NonElementParentNode, ParentNode {
5005
5005
readonly ownerDocument: Document;
5006
- getElementById(elementId: string): HTMLElement | null;
5006
+ getElementById<E extends Element = HTMLElement> (elementId: string): E | null;
5007
5007
}
5008
5008
5009
5009
declare var DocumentFragment: {
@@ -5189,7 +5189,7 @@ interface Element extends Node, Animatable, ChildNode, InnerHTML, NonDocumentTyp
5189
5189
/**
5190
5190
* 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.
5191
5191
*/
5192
- getElementsByClassName(classNames: string): HTMLCollectionOf<Element >;
5192
+ getElementsByClassName<E extends Element = HTMLElement> (classNames: string): HTMLCollectionOf<E >;
5193
5193
getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
5194
5194
getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
5195
5195
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
@@ -6640,6 +6640,7 @@ interface HTMLElement extends Element, DocumentAndElementEventHandlers, ElementC
6640
6640
readonly offsetParent: Element | null;
6641
6641
readonly offsetTop: number;
6642
6642
readonly offsetWidth: number;
6643
+ readonly parentElement: HTMLElement | null;
6643
6644
spellcheck: boolean;
6644
6645
title: string;
6645
6646
translate: boolean;
@@ -10833,7 +10834,7 @@ interface Node extends EventTarget {
10833
10834
/**
10834
10835
* Returns the parent element.
10835
10836
*/
10836
- readonly parentElement: HTMLElement | null;
10837
+ readonly parentElement: Element | null;
10837
10838
/**
10838
10839
* Returns the parent.
10839
10840
*/
@@ -11091,7 +11092,7 @@ interface NonElementParentNode {
11091
11092
/**
11092
11093
* Returns the first element within node's descendants whose ID is elementId.
11093
11094
*/
11094
- getElementById(elementId: string): Element | null;
11095
+ getElementById<E extends Element = HTMLElement> (elementId: string): E | null;
11095
11096
}
11096
11097
11097
11098
interface NotificationEventMap {
@@ -13020,7 +13021,9 @@ interface SVGElement extends Element, DocumentAndElementEventHandlers, DocumentA
13020
13021
/** @deprecated */
13021
13022
readonly className: any;
13022
13023
readonly ownerSVGElement: SVGSVGElement | null;
13024
+ readonly parentElement: SVGElement | null;
13023
13025
readonly viewportElement: SVGElement | null;
13026
+ getElementsByClassName<E extends Element = SVGElement>(classNames: string): HTMLCollectionOf<E>;
13024
13027
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
13025
13028
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
13026
13029
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -13608,6 +13611,7 @@ interface SVGForeignObjectElement extends SVGGraphicsElement {
13608
13611
readonly width: SVGAnimatedLength;
13609
13612
readonly x: SVGAnimatedLength;
13610
13613
readonly y: SVGAnimatedLength;
13614
+ getElementsByClassName<E extends Element = HTMLElement>(classNames: string): HTMLCollectionOf<E>;
13611
13615
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGForeignObjectElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
13612
13616
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
13613
13617
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGForeignObjectElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -14411,7 +14415,7 @@ interface SVGSVGElement extends SVGGraphicsElement, DocumentEvent, SVGFitToViewB
14411
14415
forceRedraw(): void;
14412
14416
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
14413
14417
getCurrentTime(): number;
14414
- getElementById(elementId: string): Element ;
14418
+ getElementById<E extends Element = HTMLElement> (elementId: string): E | null ;
14415
14419
getEnclosureList(rect: SVGRect, referenceElement: SVGElement | null): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
14416
14420
getIntersectionList(rect: SVGRect, referenceElement: SVGElement | null): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
14417
14421
pauseAnimations(): void;
0 commit comments