marcelklehr / vdom-virtualize

Virtualize a DOM node
MIT License
131 stars 27 forks source link

Didn't you forget the type ? #43

Closed cedvdb closed 7 years ago

cedvdb commented 7 years ago

I can't manage to use this with virtual-dom. If I pass a virtual node made through your library to virtual-dom createElement method, the return value is always null because the type of the object isn't VirtualNode.

Here is a quick sample trying to change a div into vdom:

let Rx = require("rxjs");
let virtualize = require('vdom-virtualize');
let h = require("virtual-dom/h")
let diff = require("virtual-dom/diff")
let createElement = require("virtual-dom/create-element")
let patch = require("virtual-dom/patch")

let d = document.getElementById('d');
let t = virtualize(d);
console.log(t); //VirtualNode {tagName: "DIV", properties: Object, children: Array[5], key: undefined, namespace: null…}
debugger
let rootNode = createElement(d)
console.log(rootNode); //root is null
marcelklehr commented 7 years ago

Actually, the code uses the virtual-dom module for creating VNodes. The problem might be a version mismatch, though. Could you check that?

marcelklehr commented 7 years ago

Just noticed: you're calling createElement on d, when you should be calling it on t. ;)