Hello! Can anyone tell me why tag builder function...
# kotlinx-html
i
Hello! Can anyone tell me why tag builder functions in JS have
TagConsumer<HTMLElement>
as a receiver, not a
TagConsumer<Element>
? I’m asking since I’m currently adding support for
wasmJs
target and during this process I’ve found out that there’s one particular builder which is failing -
svg
.
SVGElement
does not inherirt
HTMLElement
which leads to
ClassCastException
. I’m assuming that this works fine in Kotlin/JS because of its dynamic nature. Now I have 2 options: 1. Change the receiver of builder functions from
TagConsumer<HTMLElement>
to
TagConsumer<Element>
(this one is quite big change, most likely breaking change). Do anyone see there any consequences? Is there any reason to depend specifically on
HTMLElement
instead of
Element
? 2. Skip SVG in
wasmJs
target for now and leave it for the future users to figure out 🙂
Hmm, since I’m doing the new target, there will be no breaking changes and I’m free to go with option 1. Feel free to tell me if I’m wrong somehow 🙂
e
Hey @ilyagulya! Thanks for the contribution! Yep, feel free to change the receiver and ping me when the PR is ready 🙂
Sorry for the long delay