Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated child element gets appended to the end of the parent node. #27

Open
ashishtayal89 opened this issue Jun 21, 2020 · 1 comment
Open

Comments

@ashishtayal89
Copy link

ashishtayal89 commented Jun 21, 2020

If my updated element is not the last child, it is pushed to the last due to appendChild. Although we delete the updated element's dom from the parent dom, we are still appending the updated element's dom to the end.

Eg
<div id="parent"> <h2 title="child">Chapter 4 (Reconciliation)</h2> {update ? <span id="span1">span1</span> : <div id="div1">div1</div>} <div id="div2">div2</div> <div>
In the above case, the span gets appended as the last child of the parent div instead of being the 2nd child when the update becomes true. Should we be using "repalceChild" instead?

@BulingBulingWei
Copy link

I got the same problem here!
When append child, we must consider where to place the child

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants