Browse Source

Relax upperbound for ElementBuilder to Element

It's still a lie since there's a HTMLElement cast later on but it will
make possible further improvements
MERGE_HTML_BUILDER
Shagen Ogandzhanian 3 years ago
parent
commit
ee0793dcaa
  1. 4
      web/core/src/jsMain/kotlin/androidx/compose/web/elements/Base.kt

4
web/core/src/jsMain/kotlin/androidx/compose/web/elements/Base.kt

@ -80,13 +80,13 @@ class DisposableEffectHolder(
interface ElementBuilder<TElement : Element> {
fun create(): TElement
private open class ElementBuilderImplementation<TElement : HTMLElement>(private val tagName: String) : ElementBuilder<TElement> {
private open class ElementBuilderImplementation<TElement : Element>(private val tagName: String) : ElementBuilder<TElement> {
private val el: Element by lazy { document.createElement(tagName) }
override fun create(): TElement = el.cloneNode() as TElement
}
companion object {
fun <TElement : HTMLElement> createBuilder(tagName: String): ElementBuilder<TElement> {
fun <TElement : Element> createBuilder(tagName: String): ElementBuilder<TElement> {
return object : ElementBuilderImplementation<TElement>(tagName) {}
}

Loading…
Cancel
Save