aboutsummaryrefslogtreecommitdiffhomepage
path: root/nuldoc-src/dom.ts
diff options
context:
space:
mode:
Diffstat (limited to 'nuldoc-src/dom.ts')
-rw-r--r--nuldoc-src/dom.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/nuldoc-src/dom.ts b/nuldoc-src/dom.ts
index 626d400..d8f53d7 100644
--- a/nuldoc-src/dom.ts
+++ b/nuldoc-src/dom.ts
@@ -84,3 +84,24 @@ export function forEachChildRecursively(e: Element, f: (n: Node) => void) {
};
forEachChild(e, g);
}
+
+export function text(content: string): Text {
+ return {
+ kind: "text",
+ content: content,
+ raw: false,
+ };
+}
+
+export function el(
+ name: string,
+ attrs: [string, string][],
+ ...children: Node[]
+): Element {
+ return {
+ kind: "element",
+ name: name,
+ attributes: new Map(attrs),
+ children: children,
+ };
+}