Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException: "Wrong current tag" on try to change classes when class inherits HTMLTag and CommonAttributeGroupFacadeFlowInteractivePhrasingContent #148

Open
ivakub opened this issue May 20, 2020 · 0 comments

Comments

@ivakub
Copy link

ivakub commented May 20, 2020

Initial report - https://discuss.kotlinlang.org/t/custom-components/17731/5
Code:

import kotlinx.html.*
import kotlinx.html.dom.append
import kotlin.browser.document

@ExperimentalStdlibApi
fun main() {
    document.body!!.append {
        p {
            testButton()
        }
    }
}

@HtmlTagMarker
@ExperimentalStdlibApi
fun FlowOrInteractiveOrPhrasingContent.testButton() {
    TestButton(
        consumer
    )/*.test()*/
}

class TestButton(consumer: TagConsumer<*>) :
    BUTTON(
        attributesMapOf(),
        consumer
    ), Tag {
    init {
        console.log(classes)
        classes += setOf("class")
        console.log("DONE")
    }

//    fun test() {
//        classes += setOf("class")
//    }
}

Leads to the IllegalStateException on runtime:
custom-components

Dependencies:

dependencies {
    implementation(kotlin("stdlib-js"))
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.5")
    implementation("org.jetbrains:kotlin-react:16.13.0-pre.94-kotlin-1.3.70")
    implementation("org.jetbrains:kotlin-react-dom:16.13.0-pre.94-kotlin-1.3.70")
}

Project in the attachment.
halos-console.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant