aboutsummaryrefslogtreecommitdiffhomepage
path: root/nuldoc-src/dom.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-03-18 18:53:05 +0900
committernsfisis <nsfisis@gmail.com>2023-03-18 18:53:05 +0900
commit71aba3df235dc9a8acbee0e33980b30ba4ce44d4 (patch)
tree3e9b3b047b71f3293e399d21c5eb1bc252544c1b /nuldoc-src/dom.ts
parent12035272d44d92cd2360aeff88d499db67fe1949 (diff)
downloadblog.nsfisis.dev-71aba3df235dc9a8acbee0e33980b30ba4ce44d4.tar.gz
blog.nsfisis.dev-71aba3df235dc9a8acbee0e33980b30ba4ce44d4.tar.zst
blog.nsfisis.dev-71aba3df235dc9a8acbee0e33980b30ba4ce44d4.zip
refactor: add components/*.ts for shared components
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,
+ };
+}