Skip to content

Commit 99c2419

Browse files
chore(all): prepare release 1.0.0-beta.3.3.0
1 parent 9c3fa8a commit 99c2419

13 files changed

+63
-30
lines changed

dist/dom.d.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ export interface IDom {
2828
* @param callback The function that receives a notification when an event of the specified type occurs.
2929
* @param capture If true, useCapture indicates that the user wishes to initiate capture.
3030
*/
31-
addEventListener(eventName: string, callback: EventListener, capture: boolean): void;
31+
addEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture: boolean): void;
3232
/**
3333
* Remove an event listener from the document.
3434
* @param eventName A string representing the event type to listen for.
3535
* @param callback The function to remove from the event.
3636
* @param capture Specifies whether the listener to be removed was registered as a capturing listener or not.
3737
*/
38-
removeEventListener(eventName: string, callback: EventListener, capture: boolean): void;
38+
removeEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture: boolean): void;
3939
/**
4040
* Adopts a node from an external document.
4141
* @param node The node to be adopted.
@@ -47,7 +47,8 @@ export interface IDom {
4747
* @param tagName A string that specifies the type of element to be created.
4848
* @return The created element.
4949
*/
50-
createElement(tagName: string): Element;
50+
createElement<T extends keyof HTMLElementTagNameMap>(tagName: T): HTMLElementTagNameMap[T];
51+
createElement(tagName: string): HTMLElement;
5152
/**
5253
* Creates the specified HTML attribute
5354
* @param name A string that specifies the name of attribute to be created.
@@ -102,11 +103,17 @@ export interface IDom {
102103
*/
103104
getElementById(id: string): Element;
104105
/**
106+
* Performs a query selector on the document and returns first matched element, depth first.
107+
* @param query The query to use in searching the document.
108+
* @return A list of all matched elements in the document.
109+
*/
110+
querySelector<E extends Element = Element>(selectors: string): E | null;
111+
/**
105112
* Performs a query selector on the document and returns all located matches.
106113
* @param query The query to use in searching the document.
107114
* @return A list of all matched elements in the document.
108115
*/
109-
querySelectorAll(query: string): NodeList;
116+
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
110117
/**
111118
* Gets the element that is the next sibling of the provided element.
112119
* @param element The element whose next sibling is being located.
@@ -118,7 +125,7 @@ export interface IDom {
118125
* @param markup A string containing the markup to turn into a template. Note: This string must contain the template element as well.
119126
* @return The instance of HTMLTemplateElement that was created from the provided markup.
120127
*/
121-
createTemplateFromMarkup(markup: string): Element;
128+
createTemplateFromMarkup(markup: string): HTMLTemplateElement;
122129
/**
123130
* Appends a node to the parent, if provided, or the document.body otherwise.
124131
* @param newNode The node to append.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/nodejs-dom.d.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { IDom } from './dom';
22
import { IGlobal } from './global';
3+
declare module './global' {
4+
interface IGlobal {
5+
window: any;
6+
document: any;
7+
}
8+
}
39
/**
410
* Represents the core APIs of the DOM.
511
*/
@@ -12,22 +18,23 @@ export declare class NodeJsDom implements IDom {
1218
boundary: string;
1319
title: string;
1420
activeElement: Element;
15-
addEventListener(eventName: string, callback: EventListener, capture: boolean): void;
16-
removeEventListener(eventName: string, callback: EventListener, capture: boolean): void;
17-
createElement(tagName: string): Element;
21+
addEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture: boolean): void;
22+
removeEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture: boolean): void;
23+
createElement<T extends keyof HTMLElementTagNameMap>(tagName: T): HTMLElementTagNameMap[T];
1824
createAttribute(name: string): Attr;
1925
createTextNode(text: string): Text;
2026
createComment(text: string): Comment;
2127
createDocumentFragment(): DocumentFragment;
2228
createTemplateElement(): HTMLTemplateElement;
2329
createMutationObserver(callback: (changes: MutationRecord[], instance: MutationObserver) => void): MutationObserver;
24-
createCustomEvent(eventType: string, options: Object): CustomEvent;
30+
createCustomEvent(eventType: string, options?: Object): CustomEvent;
2531
dispatchEvent(evt: Event): void;
2632
getComputedStyle(element: Element): CSSStyleDeclaration;
2733
getElementById(id: string): Element;
28-
querySelectorAll(query: string): NodeList;
34+
querySelector<E extends Element = Element>(query: string): E | null;
35+
querySelectorAll<E extends Element = Element>(query: string): NodeListOf<E>;
2936
nextElementSibling(element: Element): Element;
30-
createTemplateFromMarkup(markup: string): Element;
37+
createTemplateFromMarkup(markup: string): HTMLTemplateElement;
3138
injectStyles(styles: string, destination?: Element, prepend?: boolean): Node;
3239
adoptNode(node: Node): Node;
3340
appendNode(newNode: Node, parentNode?: Node): void;

dist/nodejs-dom.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)