We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b5dc83 commit b96fc34Copy full SHA for b96fc34
frontend/src/utils/attribution-html.ts
@@ -46,9 +46,31 @@ const h = (
46
attrs: Record<string, string>,
47
children: string[] | null = null
48
): string => {
49
+ const selfClosingTags = [
50
+ "area",
51
+ "base",
52
+ "br",
53
+ "col",
54
+ "embed",
55
+ "hr",
56
+ "img",
57
+ "input",
58
+ "link",
59
+ "meta",
60
+ "param",
61
+ "source",
62
+ "track",
63
+ "wbr",
64
+ ]
65
+
66
const map = Object.entries(attrs)
67
.map(([key, value]) => `${key}="${value}"`)
68
.join(" ")
69
70
+ if (selfClosingTags.includes(name)) {
71
+ return map ? `<${name} ${map} />` : `<${name} />`
72
+ }
73
74
const opening = map ? `<${name} ${map}>` : `<${name}>`
75
const closing = `</${name}>`
76
return `${opening}${(children ?? []).join("\n")}${closing}`
0 commit comments