[Question] Is it possible to create a virtual dom based on an existing dom element
soyuka opened this issue · comments
I was wondering if there is a way to create a virtual hyperscript node from an existing element. For example:
h(document.getElementById('exists'), {properties}, [childrens])
I found that I could init a node without using h()
by returning the expected result, for example:
{
vnodeSelector: 'input',
properties: {
type: 'text',
},
text: undefined,
domNode: document.getElementById('exists')
},
I thought that by specifying the domNode it won't be appended, but it's anyway.
This would be helpfull if you want to add features to an existing dom element, but maybe it's out of scope. Thanks.
Maybe related to #53
You could use the Projector.merge method, see http://maquettejs.org/docs/typedoc/interfaces/_maquette_.projector.html#merge).
Is this what you need?
Perfect thanks! This example was very useful btw https://github.com/AFASSoftware/maquette/blob/c72c72f7cb65dbb2dc738ea9f79e5b15d634ea5a/examples/enhancement/index.js