Skip to content

Commit 6e25dc9

Browse files
authored
fix(core): missing checking vnode type in creating, fixed #19 (#20)
1 parent 98995ee commit 6e25dc9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/runtime/dom/dom.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ import { camelToDash } from "../utils/others";
1010
*
1111
* @param node the vnode
1212
*/
13-
export function createElement(node: VNode): Node {
13+
export function createElement(node: VNode | VNode[]): Node {
14+
if (Array.isArray(node)) {
15+
const fragment = document.createDocumentFragment();
16+
for (const child of node) {
17+
fragment.appendChild(createElement(child));
18+
}
19+
return fragment;
20+
}
1421
// create a dom node according to the tag name of the vnode
1522
const el =
1623
node.tagName === "Fragment"

0 commit comments

Comments
 (0)