diff options
| author | Petri Hienonen <petri.hienonen@gmail.com> | 2025-11-13 18:12:17 +0200 |
|---|---|---|
| committer | Petri Hienonen <petri.hienonen@gmail.com> | 2025-11-13 18:12:17 +0200 |
| commit | e4fdd8457d2d320eea502f0801fc22eceb8947b1 (patch) | |
| tree | 110530c498b276085bb409a537a3e2174d53d435 /app/dom.js | |
| parent | 2113f8269423932fa76ae4f822f77a07dd703266 (diff) | |
| download | housing-e4fdd8457d2d320eea502f0801fc22eceb8947b1.tar.zst | |
Nothing
Diffstat (limited to 'app/dom.js')
| -rw-r--r-- | app/dom.js | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -120,6 +120,20 @@ export class Dom { } /** + * Create a `<a>` + * @param {DomOptions} o + */ + static a(o) { + const link = document.createElement("a"); + Object.assign(link.style, o.styles); + if (o.id) link.id = o.id; + for (const cls of o.classes) link.classList.add(cls); + for (const [k, v] of Object.entries(o.attributes)) link.setAttribute(k, v); + if (o.children) link.append(...o.children); + return link; + } + + /** * Create a `<label>` * @param {string} to * @param {string} text |
