UNPKG

2.69 kBTypeScriptView Raw
1/**
2 * @type {Document}
3 */
4export const doc: Document;
5export function createElement(name: string): HTMLElement;
6export function createDocumentFragment(): DocumentFragment;
7export function createTextNode(text: string): Text;
8export const domParser: DOMParser;
9export function emitCustomEvent(el: HTMLElement, name: string, opts: Object): boolean;
10export function setAttributes(el: Element, attrs: Array<pair.Pair<string, string | boolean>>): Element;
11export function setAttributesMap(el: Element, attrs: Map<string, string>): Element;
12export function fragment(children: Array<Node> | HTMLCollection): DocumentFragment;
13export function append(parent: Element, nodes: Array<Node>): Element;
14export function remove(el: HTMLElement): void;
15export function addEventListener(el: EventTarget, name: string, f: EventListener): void;
16export function removeEventListener(el: EventTarget, name: string, f: EventListener): void;
17export function addEventListeners(node: Node, listeners: Array<pair.Pair<string, EventListener>>): Node;
18export function removeEventListeners(node: Node, listeners: Array<pair.Pair<string, EventListener>>): Node;
19export function element(name: string, attrs?: Array<pair.Pair<string, string> | pair.Pair<string, boolean>>, children?: Array<Node>): Element;
20export function canvas(width: number, height: number): HTMLCanvasElement;
21export function text(text: string): Text;
22export function pairToStyleString(pair: pair.Pair<string, string>): string;
23export function pairsToStyleString(pairs: Array<pair.Pair<string, string>>): string;
24export function mapToStyleString(m: Map<string, string>): string;
25export function querySelector(el: HTMLElement | ShadowRoot, query: string): HTMLElement | null;
26export function querySelectorAll(el: HTMLElement | ShadowRoot, query: string): NodeListOf<HTMLElement>;
27export function getElementById(id: string): HTMLElement;
28export function parseFragment(html: string): DocumentFragment;
29export function parseElement(html: string): HTMLElement;
30export function replaceWith(oldEl: HTMLElement, newEl: HTMLElement | DocumentFragment): void;
31export function insertBefore(parent: HTMLElement, el: HTMLElement, ref: Node | null): HTMLElement;
32export function appendChild(parent: Node, child: Node): Node;
33export const ELEMENT_NODE: 1;
34export const TEXT_NODE: 3;
35export const CDATA_SECTION_NODE: 4;
36export const COMMENT_NODE: 8;
37export const DOCUMENT_NODE: 9;
38export const DOCUMENT_TYPE_NODE: 10;
39export const DOCUMENT_FRAGMENT_NODE: 11;
40export function checkNodeType(node: any, type: number): boolean;
41export function isParentOf(parent: Node, child: HTMLElement): boolean;
42import * as pair from './pair.js';
43//# sourceMappingURL=dom.d.ts.map
\No newline at end of file