Reuben Firmin
11/14/2023, 2:17 PMcompanion object {
fun <R> TagConsumer<R>.kpis() {
vs
companion object {
fun FlowContent.kpis() {
I want to call this function:
a) from the DSL
b) when building an html fragment like this:
fun render(): String {
return buildString {
appendHTML().kpis()
}
}
I can make the FlowContent variation at least compile with:
fun render(): String {
return buildString {
appendHTML().div {
kpis()
}
}
}
... but it blows up in weird waysReuben Firmin
11/14/2023, 2:27 PMjava.lang.IllegalArgumentException: Tag svg has invalid attribute name xmlns
at kotlinx.html.stream.HTMLStreamBuilder.onTagStart(stream.kt:30)
at kotlinx.html.consumers.DelayedConsumer.processDelayedTag(delayed-consumer.kt:59)
at kotlinx.html.consumers.DelayedConsumer.onTagStart(delayed-consumer.kt:10)
...however, this function rendered just fine when it was included in a whole page dsl. it's only as a fragment that it diesReuben Firmin
11/14/2023, 2:28 PMjava.lang.IllegalStateException: You can't change tag attribute because it was already passed to the downstream
at kotlinx.html.consumers.DelayedConsumer.onTagAttributeChange(delayed-consumer.kt:16)
at kotlinx.html.impl.DelegatingMap.put(delegating-map.kt:27)
at kotlinx.html.impl.DelegatingMap.put(delegating-map.kt:5)
where, again, it was fine as part of the whole pagee5l
11/28/2023, 11:47 AMReuben Firmin
11/28/2023, 11:48 AM