-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
153 lines (151 loc) · 3.72 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
/**
* Parse string input to a html tree, return the root node.
*
*/
function parse(html: string): NodeRepr
export declare class NodeRepr {
/**
* Append a child node to this node, after existing children.
*
* The child node will be remove from its previous position.
*
*/
append(newChild: NodeRepr): void
/**
* Append some children nodes to this node by order, after existing children.
*
* These children nodes will be remove from their previous position.
*
*/
appendSequence(newChildren: Array<NodeRepr>): void
/**
* Prepend a child node to this node, before existing children.
*
* The child node will be remove from its previous position.
*
*/
prepend(newChild: NodeRepr): void
/**
* Prepend some children nodes to this node by order, before existing children.
*
* These children nodes will be remove from their previous position.
*
*/
prependSequence(newChildren: Array<NodeRepr>): void
/**
* Insert a new sibling after this node.
*
* The sibling node will be remove from its previous position.
*
*/
insertAfter(newSibling: NodeRepr): void
/**
* Insert some siblings after this node.
*
* These sibling nodes will be remove from their previous position.
*
*/
insertSequenceAfter(newSiblings: Array<NodeRepr>): void
/**
* Insert a new sibling before this node.
*
* The sibling node will be remove from its previous position.
*
*/
insertBefore(newSibling: NodeRepr): void
/**
* Insert some siblings before this node.
*
* These sibling nodes will be remove from their previous position.
*
*/
insertSequenceBefore(newSiblings: Array<NodeRepr>): void
/**
* Remove a node from its parent and siblings. Children are not affected.
*
*/
remove(): void
/**
* Assign an attribute K-V to this node
*
*/
setAttribute(name: string, value: string): void
/**
* Assign attributes K-V object to this node.
*
*/
setAttributes(attrs: Record<string, string>): void
/**
* Remove an attribute of this node by name.
*
*/
removeAttribute(name: string): void
/**
*Remove all attributes of this node.
*
*/
removeAllAttributes(): void
/**
* Select the the fist node that match the given css selector, like document.querySelector.
*
*/
select(selectors: string): NodeRepr | null
/**
* Select all nodes that match the given css selector, like document.querySelectorAll.
*
*/
selectAll(selectors: string): Array<NodeRepr>
/**
* Get all children nodes of this node.
*
*/
getChildren(): Array<NodeRepr>
/**
* Get attribute value of this node by given name.
*
*/
getAttribute(name: string): string | null
/**
* Get attributes K-V object of this node.
*
*/
getAttributes(): Record<string, string>
/**
* Get the serialized html of this node, including its all descendants and itelf.
*
*/
outerHtml(): string
/**
* Get the serialized html of this node, only including its all descendants.
*
*/
innerHtml(): string
/**
* Get all text nodes content of this node, including its all descendants and itelf.
*
*/
text(): string
/**
* The node object, cann't be instantiated in javascript. So call the constructor will throw an error.
*
*/
constructor(): void
/**
* Clone this node to a new instance, not clone its descendants.
*
*/
clone(): NodeRepr
/**
* Clone this node to a new instance, including its all descendants.
*
*/
cloneRecursive(): NodeRepr
}
export declare interface NodeRepr {
select(selectors: "html"): NodeRepr;
select(selectors: "head"): NodeRepr;
select(selectors: "body"): NodeRepr;
}