diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-03-18 18:53:05 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-03-18 18:53:05 +0900 |
| commit | 71aba3df235dc9a8acbee0e33980b30ba4ce44d4 (patch) | |
| tree | 3e9b3b047b71f3293e399d21c5eb1bc252544c1b /nuldoc-src/dom.ts | |
| parent | 12035272d44d92cd2360aeff88d499db67fe1949 (diff) | |
| download | blog.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.ts | 21 |
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, + }; +} |
