Skip to content

Commit 7e34c6e

Browse files
committed
Fix bug where attribute names were the tag name
1 parent 663a8fd commit 7e34c6e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/element.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ export default class Element {
44
element: HTMLElement;
55

66
constructor(
7-
name: string,
7+
tagName: string,
88
attributes: AttributesType | null,
99
...children: (Element | string | number)[]
1010
) {
11-
this.element = document.createElement(name);
11+
this.element = document.createElement(tagName);
1212
const trueAttributes = attributes || {};
1313
Object.entries(trueAttributes).forEach(([key, value]) => {
1414
if (key.startsWith("on") && key.toLowerCase() in window) {
@@ -17,7 +17,7 @@ export default class Element {
1717
value as EventListener
1818
);
1919
} else {
20-
this.element.setAttribute(name, value.toString());
20+
this.element.setAttribute(key, value.toString());
2121
}
2222
});
2323
children.forEach((child) => {

0 commit comments

Comments
 (0)