Skip to content

Commit

Permalink
refactor: fix last issue in a different way
Browse files Browse the repository at this point in the history
  • Loading branch information
aralroca committed Nov 3, 2023
1 parent d4e0ffc commit 71422a1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/brisa-element/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const createElement = (
tagName: string,
parent?: HTMLElement | DocumentFragment,
) => {
if (typeof tagName !== "string") return tagName;
return tagName === "svg" ||
((parent as HTMLElement)?.namespaceURI === SVG_NAMESPACE &&
lowercase((parent as HTMLElement).tagName) !== "foreignobject")
Expand Down Expand Up @@ -91,7 +90,7 @@ export default function brisaElement(
) as HTMLElement;

// Handle attributes
for (let [key, value] of Object.entries(attributes ?? {})) {
for (let [key, value] of Object.entries(attributes)) {
const isEvent = key.startsWith("on");

if (isEvent) {
Expand Down Expand Up @@ -140,7 +139,7 @@ export default function brisaElement(
for (let c of child as Children[]) {
hyperScript(null, {}, c, fragment);
}
} else {
} else if (child.length) {
hyperScript(...(child as [string, Attr, Children]), fragment);
}

Expand Down

0 comments on commit 71422a1

Please sign in to comment.