Testing dom diffing

This commit is contained in:
2017-09-11 13:44:39 +02:00
parent 34dcd6fc75
commit 6a69ce85cb
2 changed files with 17 additions and 4 deletions

View File

@@ -110,11 +110,16 @@ abstract class Komponent {
fun refresh(element: HTMLElement?) {
if (element != null) {
elements[element]?.let {
val parent = element.parentElement
//val parent = element.parentElement
val newElement = it.create()
parent?.replaceChild(newElement, element)
//DomDiffer.replaceDiff(newElement, element)
//parent?.replaceChild(newElement, element)
val replacedElement = DomDiffer.replaceDiff(newElement, element)
it.element = replacedElement
elements.remove(replacedElement)
elements[replacedElement] = it
}
}
}