Skip to content

Commit

Permalink
correctly insert static nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nefsen402 committed Mar 30, 2024
1 parent 4d1780d commit 3ffa076
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export const h = (e, props = {}, ...children) => {
}

const signals = [];
let bef = noop;
let bef = noop, insertLoc = null;

children = [];
props.children?.findLast(child => {
Expand All @@ -330,8 +330,9 @@ export const h = (e, props = {}, ...children) => {
}

if (child) {
if (!child.parentElement) e.insertBefore(child, bef());
if (!child.parentElement) e.insertBefore(child, insertLoc);
bef = () => child;
insertLoc = child;
}
});
delete props.children;
Expand Down

0 comments on commit 3ffa076

Please sign in to comment.