Last active
April 21, 2018 21:57
-
-
Save lejeunerenard/13eba4ddce29a276119e30470bb67123 to your computer and use it in GitHub Desktop.
Nanocomponent Proxy Issue in Reordered List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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