when passing replace = true to mount , exisiting element is not replaced with correct new tag
See original GitHub issueHi,
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.
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (6 by maintainers)
Top Results From Across the Web
<input>: The Input (Form Input) element - HTML
The HTML element is used to create interactive controls for web-based forms in order ... this content attribute does not reflect the change....
Read more >Correct way to handle conditional styling in React
There's no "correct" way to do conditional styling. Do whatever works best for you. For myself, I prefer to avoid inline styling and...
Read more >5. Working with Arrays and Loops - JavaScript Cookbook [Book]
The splice method is then used in a loop to replace all of the elements with this one value with elements with a...
Read more >Use Google Tag Manager to pass values to Floodlight tags
Traditionally, newly created Floodlight tags contain placeholders that web developers replace with the required values at the time when the tag is called....
Read more >The data layer | Google Tag Manager for Web
The data layer is an object used by Google Tag Manager and gtag.js to pass information to tags. Events or variables can be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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
div
root to replacebody
.sorry this took till now. was focused on getting v2 out.
this should be fixed, plz reopen if it’s still an issue.