UNPKG

2.6 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/dom4`
3
4# Summary
5This package contains type definitions for dom4 (https://github.com/WebReflection/dom4).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dom4.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dom4/index.d.ts)
10````ts
11// Type definitions for dom4 v2.0
12// Project: https://github.com/WebReflection/dom4
13// Definitions by: Adi Dahiya <https://github.com/adidahiya>, Gilad Gray <https://github.com/giladgray>
14// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
15
16/**
17 * https://dom.spec.whatwg.org/#parentnode
18 */
19interface ParentNode {
20 /**
21 * Returns the child elements.
22 */
23 readonly children: HTMLCollection;
24
25 /**
26 * Inserts `nodes` after the last child of this node, while replacing strings with equivalent `Text` nodes.
27 */
28 append(...nodes: Array<Node | string>): void;
29
30 /**
31 * Inserts `nodes` before the first child of this node, while replacing strings with equivalent `Text` nodes.
32 */
33 prepend(...nodes: Array<Node | string>): void;
34}
35
36/**
37 * https://dom.spec.whatwg.org/#childnode
38 */
39interface ChildNode {
40 /**
41 * Inserts `nodes` just after this node, while replacing strings with equivalent `Text` nodes.
42 */
43 after(...nodes: Array<Node | string>): void;
44
45 /**
46 * Inserts `nodes` just before this node, while replacing strings with equivalent `Text` nodes.
47 */
48 before(...nodes: Array<Node | string>): void;
49
50 /**
51 * Replaces this node with `nodes`, while replacing strings in nodes with equivalent Text nodes.
52 */
53 replaceWith(...nodes: Array<Node | string>): void;
54
55 /**
56 * Removes this node.
57 */
58 remove(): void;
59}
60
61interface Element extends ParentNode {
62 /**
63 * Returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise.
64 */
65 closest(selectors: string): Element | null;
66
67 /**
68 * Returns true if matching selectors against element’s root yields element, and false otherwise.
69 */
70 matches(selectors: string): boolean;
71}
72
73interface Elements extends ParentNode, Array<Element> {
74}
75
76interface Document extends ParentNode {
77}
78
79interface DocumentFragment extends ParentNode {
80}
81
82````
83
84### Additional Details
85 * Last updated: Fri, 09 Jul 2021 02:32:25 GMT
86 * Dependencies: none
87 * Global values: none
88
89# Credits
90These definitions were written by [Adi Dahiya](https://github.com/adidahiya), and [Gilad Gray](https://github.com/giladgray).
91
\No newline at end of file