Add include on form element

This commit is contained in:
2017-08-01 19:30:32 +02:00
parent 154fa0cc26
commit 30c360e4cc
5 changed files with 12 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
package nl.astraeus.komp
import kotlinx.html.DIV
import kotlinx.html.FORM
import kotlinx.html.TagConsumer
import kotlinx.html.dom.create
import org.w3c.dom.HTMLElement
@@ -13,6 +14,13 @@ fun DIV.include(component: Komponent) {
Komponent.define(result, component)
}
fun FORM.include(component: Komponent) {
val result = component.render(this.consumer as TagConsumer<HTMLElement>)
component.element = result
Komponent.define(result, component)
}
abstract class Komponent {
var element: HTMLElement? = null
var rendered = false