Fix Komponent.create, v. 0.5.8

Took 7 minutes
This commit is contained in:
2021-12-04 11:49:36 +01:00
parent db8fc642cf
commit 80a9a28731
7 changed files with 65 additions and 68 deletions

View File

@@ -4,7 +4,6 @@ import kotlinx.browser.window
import org.w3c.dom.Element
import org.w3c.dom.HTMLElement
import org.w3c.dom.Node
import org.w3c.dom.css.CSSStyleDeclaration
import org.w3c.dom.get
import kotlin.reflect.KProperty
@@ -40,13 +39,12 @@ abstract class Komponent {
private var lastMemoizeHash: Int? = null
var element: Node? = null
val declaredStyles: MutableMap<String, CSSStyleDeclaration> = HashMap()
open fun create(parent: Element, childIndex: Int? = null) {
onBeforeUpdate()
val builder = HtmlBuilder(
parent,
childIndex ?: parent.childElementCount
childIndex ?: parent.childNodes.length
)
builder.render()