Skip to content

Commit 2475d2e

Browse files
committed
docs(node): Add descriptions for Node classes
1 parent 8dc6824 commit 2475d2e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/node.ts

+22
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ export class Node {
7878
}
7979
}
8080

81+
/**
82+
* A node that contains some data.
83+
*/
8184
export class DataNode extends Node {
8285
/**
8386
* @param type The type of the node
@@ -99,18 +102,27 @@ export class DataNode extends Node {
99102
}
100103
}
101104

105+
/**
106+
* Text within the document.
107+
*/
102108
export class Text extends DataNode {
103109
constructor(data: string) {
104110
super(ElementType.Text, data);
105111
}
106112
}
107113

114+
/**
115+
* Comments within the document.
116+
*/
108117
export class Comment extends DataNode {
109118
constructor(data: string) {
110119
super(ElementType.Comment, data);
111120
}
112121
}
113122

123+
/**
124+
* Processing instructions, including doc types.
125+
*/
114126
export class ProcessingInstruction extends DataNode {
115127
constructor(public name: string, data: string) {
116128
super(ElementType.Directive, data);
@@ -161,6 +173,9 @@ export class NodeWithChildren extends Node {
161173
}
162174
}
163175

176+
/**
177+
* The root node of the document.
178+
*/
164179
export class Document extends NodeWithChildren {
165180
constructor(children: Node[]) {
166181
super(ElementType.Root, children);
@@ -169,12 +184,19 @@ export class Document extends NodeWithChildren {
169184
"x-mode"?: "no-quirks" | "quirks" | "limited-quirks";
170185
}
171186

187+
/**
188+
* The description of an individual attribute.
189+
*/
172190
interface Attribute {
173191
name: string;
174192
value: string;
175193
namespace?: string;
176194
prefix?: string;
177195
}
196+
197+
/**
198+
* An element within the DOM.
199+
*/
178200
export class Element extends NodeWithChildren {
179201
/**
180202
* @param name Name of the tag, eg. `div`, `span`.

0 commit comments

Comments
 (0)