domvm: when passing replace = true to mount , exisiting element is not replaced with correct new tag
Hi,
maybe this is stupid but i wanted to know if i am doing it wrong or it is a bug or intentional behavior.
place holder to mount the VDom into it
<div class="placeholder"></div>
DOMVM code
let domView = domvm.view((vm)=> {
return ()=>["ul",
names.map((name)=> {
return [`li`, name]
})
]
}).mount(document.querySelector(`.placeholder`), true);
the result
<div class="placeholder">
<li>Mike</li>
<li>Roman</li>
<li>John</li>
</div>
as you see the resulting HTML is having a DIV as a root tag instead of UL.
the way i think about it that when we chose to replace, then the mount to element should be replaced fully with the correct DOMVM root tag.
thanks in advanced.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (6 by maintainers)
@lawrence-dol there’s no roadblock here to getting things working as expected.
for
true, it will simply recreate & replaceNode the target if the nodeName doesnt match the expected tag unless the target isbody, in which case it will do what it already does (patch attrs, handlers and create the children).I’ll be happy to humor anyone who files a bug expecting a template
divroot to replacebody.