diff --git a/src/main/kotlin/nl/astraeus/komp/Komponent.kt b/src/main/kotlin/nl/astraeus/komp/Komponent.kt index c5c78bd..96d0d35 100644 --- a/src/main/kotlin/nl/astraeus/komp/Komponent.kt +++ b/src/main/kotlin/nl/astraeus/komp/Komponent.kt @@ -1,9 +1,6 @@ package nl.astraeus.komp -import kotlinx.html.DIV -import kotlinx.html.FORM -import kotlinx.html.SPAN -import kotlinx.html.TagConsumer +import kotlinx.html.* import kotlinx.html.dom.create import org.w3c.dom.Element import org.w3c.dom.HTMLElement @@ -30,6 +27,13 @@ fun FORM.include(component: Komponent) { Komponent.define(result, component) } +fun TD.include(component: Komponent) { + val result = component.render(this.consumer as TagConsumer) + + component.element = result + Komponent.define(result, component) +} + abstract class Komponent { var element: Element? = null var rendered = false