VNode.data can be undefined and should be used normally
dmoosocool opened this issue · comments
import {
init,
classModule,
styleModule,
eventListenersModule,
h,
vnode,
} from "../../build/index.js";
const patch = init(
[classModule, styleModule, eventListenersModule],
undefined,
{ experimental: { fragments: true } }
);
const container = document.getElementById("container");
const render = () => {
const patched = patch(
container,
vnode(
undefined,
undefined,
[
vnode("h1", undefined, undefined, "hello", undefined),
vnode("h1", undefined, undefined, "snabbdom", undefined),
],
undefined,
undefined
)
);
console.log(patched);
};
render();
throw an error:
class.ts:11 Uncaught TypeError: Cannot read properties of undefined (reading 'class')
at Array.updateClass (class.ts:11)
at createElm (init.ts:176)
at createElm (init.ts:205)
at patch (init.ts:431)
at render (index.js:36)
at index.js:52