diff --git a/.idea/modules/komp.iml b/.idea/modules/komp.iml index a1066ea..a7df91a 100644 --- a/.idea/modules/komp.iml +++ b/.idea/modules/komp.iml @@ -1,5 +1,5 @@ - + diff --git a/.idea/modules/komp_main.iml b/.idea/modules/komp_main.iml index 3dda587..05e2329 100644 --- a/.idea/modules/komp_main.iml +++ b/.idea/modules/komp_main.iml @@ -1,5 +1,5 @@ - + diff --git a/.idea/modules/komp_test.iml b/.idea/modules/komp_test.iml index 0b505a9..c6bb829 100644 --- a/.idea/modules/komp_test.iml +++ b/.idea/modules/komp_test.iml @@ -1,5 +1,5 @@ - + diff --git a/build.gradle b/build.gradle index 7f1b41c..7e67818 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '0.0.4-SNAPSHOT' +version '0.0.5-SNAPSHOT' apply plugin: 'kotlin2js' apply plugin: 'idea' diff --git a/src/main/kotlin/nl/astraeus/komp/Komponent.kt b/src/main/kotlin/nl/astraeus/komp/Komponent.kt index 92c5838..79c8555 100644 --- a/src/main/kotlin/nl/astraeus/komp/Komponent.kt +++ b/src/main/kotlin/nl/astraeus/komp/Komponent.kt @@ -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) + + component.element = result + Komponent.define(result, component) +} + abstract class Komponent { var element: HTMLElement? = null var rendered = false