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

@@ -112,7 +112,7 @@ private fun Element.getKompAttributes(): MutableSet<String> {
return result
}
private fun Element.setKompAttribute(name: String, value: String) {
fun Element.setKompAttribute(name: String, value: String) {
val setAttrs: MutableSet<String> = getKompAttributes()
setAttrs.add(name)
@@ -388,7 +388,7 @@ class HtmlBuilder(
element.focus()
}
if (!setAttrs.contains(attr.name)) {
if (attr.name != "style" && !setAttrs.contains(attr.name)) {
if (element is HTMLInputElement) {
if (attr.name == "checkbox") {
element.checked = false
@@ -515,7 +515,7 @@ class HtmlBuilder(
val container = document.createElement("div") as HTMLElement
val consumer = HtmlBuilder(container, 0)
content.invoke(consumer)
return consumer.root ?: error("error")
return consumer.root ?: error("No root element found after render!")
}
}
}