question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

when passing replace = true to mount , exisiting element is not replaced with correct new tag

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
leeoniyacommented, Aug 23, 2016

@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 is body, 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 replace body.

0reactions
leeoniyacommented, Jan 11, 2017

sorry this took till now. was focused on getting v2 out.

this should be fixed, plz reopen if it’s still an issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found