Skip to content

Instantly share code, notes, and snippets.

@lejeunerenard
Last active April 21, 2018 21:57
Show Gist options
  • Save lejeunerenard/13eba4ddce29a276119e30470bb67123 to your computer and use it in GitHub Desktop.
Save lejeunerenard/13eba4ddce29a276119e30470bb67123 to your computer and use it in GitHub Desktop.
Nanocomponent Proxy Issue in Reordered List
const morph = require('nanomorph')
const html = require('bel')
const Nanocomponent = require('nanocomponent')
class Display extends Nanocomponent {
createElement (state) {
return html`<div>Display</div>`
}
update () { return true }
}
const display = new Display()
const tree = html`
<ul>
<li><a href="">1</a></li>
<li><a href="">2</a></li>
<li>${display.render()}</li>
<li><a href="">3</a></li>
<li><a href="">4</a></li>
</ul>
`
document.body.appendChild(tree)
let newTree = html`
<ul>
<li><a href="">1</a></li>
<li>${display.render()}</li>
<li><a href="">3</a></li>
<li><a href="">4</a></li>
</ul>
`
morph(tree, newTree)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment