Skip to content

Commit

Permalink
fix(core): missing checking vnode type in creating, fixed #19 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
wibus-wee authored Dec 22, 2022
1 parent 98995ee commit 6e25dc9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/runtime/dom/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ import { camelToDash } from "../utils/others";
*
* @param node the vnode
*/
export function createElement(node: VNode): Node {
export function createElement(node: VNode | VNode[]): Node {
if (Array.isArray(node)) {
const fragment = document.createDocumentFragment();
for (const child of node) {
fragment.appendChild(createElement(child));
}
return fragment;
}
// create a dom node according to the tag name of the vnode
const el =
node.tagName === "Fragment"
Expand Down

0 comments on commit 6e25dc9

Please sign in to comment.