Testing builder call syntax

This commit is contained in:
2019-11-17 20:37:46 +01:00
parent ff761487a3
commit a407d7e486
3 changed files with 7 additions and 6 deletions

View File

@@ -26,14 +26,15 @@ abstract class Komponent {
open fun create(): HTMLElement {
val consumer = HtmlBuilder(this, document)
val result = render(consumer)
consumer.render()
val result = consumer.finalize()
element = result
return result
}
abstract fun render(consumer: HtmlBuilder): HTMLElement
abstract fun HtmlBuilder.render()
open fun style(className: String, vararg imports: CssStyle, block: CSSStyleDeclaration.() -> Unit = {}) {
val style = (document.createElement("div") as HTMLDivElement).style