Stefan Oltmann
12/26/2023, 3:57 PMinnerHTML
not work in this context?
How can I solve that?
https://github.com/StefanOltmann/exif-viewer/issues/8Chrimaeon
12/26/2023, 4:40 PM:hover
that you can use to style elements that are hovered.
https://developer.mozilla.org/en-US/docs/Web/CSS/:hover?retiredLocale=deChrimaeon
12/26/2023, 4:46 PMscript
tags are not executed when set via innerHtml
https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML?retiredLocale=de#security_considerationsStefan Oltmann
12/26/2023, 5:19 PMHTML specifies that aI overlooked this part. 😅tag inserted with<script>
should not execute.innerHTML
Stefan Oltmann
12/26/2023, 5:23 PMwhy do you need the javascript? there is a pseudo classIt's more than that. I want to hover all elements that have the same class. Hover the values in the last column here and you will see.that you can use to style elements that are hovered.:hover
Chrimaeon
12/26/2023, 5:26 PMChrimaeon
12/26/2023, 5:27 PMStefan Oltmann
12/26/2023, 5:39 PMinnerHTML
.
I don't feel that the question does not belong here:
My JavaScript generally works and I'm not asking how to replace it. It stops working in this Kotlin/WASM (or Kotlin/JS?) context for some reason.
Maybe I need to execute some of that using js("code")
instead?Stefan Oltmann
12/26/2023, 5:44 PMdocument.querySelectorAll()
may not look into the innerHTML
of my DIV tags. If that's the reason I don't know how I otherwise could inject HTML from Kotlin into my index.html ... maybe the feature I wanted to add is not possible.Chrimaeon
12/26/2023, 5:50 PMMaybe I need to execute some of that usingwhy do you not use kotlin for the whole javascript “string” that you inject somewhere?instead?js("code")
Chrimaeon
12/26/2023, 5:51 PMquerySelectorAll
is available as a kotlin function
https://kotlinlang.org/api/latest/jvm/stdlib/org.w3c.dom/-document/query-selector-all.htmlStefan Oltmann
12/26/2023, 6:01 PM.hex-box span:hover {
background-color: yellow;
This will only color the span I hovered. There are always two spans with the same class present - the label & the value.}
Chrimaeon
12/26/2023, 6:01 PMOh...
I suspect that the JavaScriptare you sure you use Kotlin/WASM correctly. You do not add anything in your html. you would just “load” the generated wasm file and execute it as part of the HTML.may not look into thedocument.querySelectorAll()
of my DIV tags. If that’s the reason I don’t know how I otherwise could inject HTML from Kotlin into my index.html ... maybe the feature I wanted to add is not possible.innerHTML
Stefan Oltmann
12/26/2023, 6:04 PMChrimaeon
12/26/2023, 6:07 PMStefan Oltmann
12/26/2023, 6:10 PMexports.default.processFile(uInt8Bytes);
I should call a second exported method that generates the HTML?
But what would I do with it if not setting the inner HTML?
It's not like JSP here.Chrimaeon
12/26/2023, 6:12 PMStefan Oltmann
12/26/2023, 6:14 PMChrimaeon
12/26/2023, 6:19 PMhtml
and alter the DOM in the initial html site. there are frameworks for it like react and vue. that would make you life much easier. Or even create a Compose Web Application then you would not have to deal with anything else than kotlin.Chrimaeon
12/26/2023, 6:20 PMStefan Oltmann
12/26/2023, 6:39 PMStefan Oltmann
12/26/2023, 6:40 PMChrimaeon
12/26/2023, 6:41 PMChrimaeon
12/26/2023, 6:43 PMStefan Oltmann
12/26/2023, 8:24 PMStefan Oltmann
12/26/2023, 8:25 PMChrimaeon
12/26/2023, 8:27 PMStefan Oltmann
12/26/2023, 8:28 PMChrimaeon
12/26/2023, 8:29 PMStefan Oltmann
12/26/2023, 8:32 PMChrimaeon
12/26/2023, 8:34 PMStefan Oltmann
12/26/2023, 8:35 PMStefan Oltmann
12/26/2023, 8:37 PMChrimaeon
12/26/2023, 8:37 PMChrimaeon
12/26/2023, 8:38 PMStefan Oltmann
12/26/2023, 8:38 PMStefan Oltmann
12/26/2023, 8:39 PMChrimaeon
12/26/2023, 8:39 PMStefan Oltmann
12/26/2023, 8:40 PMStefan Oltmann
12/26/2023, 8:41 PMChrimaeon
12/26/2023, 8:41 PMChrimaeon
12/26/2023, 8:43 PMStefan Oltmann
12/26/2023, 8:45 PMChrimaeon
12/26/2023, 8:47 PMStefan Oltmann
12/26/2023, 9:00 PMDOMContentLoaded
event would be triggered every time the DOM gets manipulated.
This is my first web project ever 😅
I don't like JavaScript and used to develop solely on Desktop & mobile in the past 17 years. 😄
Kotlin for WebAssembly is a good reason to dive into web dev now.
If that works I will rewrite all the JS functions of the app in Kotlin, because I prefer to have everything in Kotlin. 🙂Stefan Oltmann
12/26/2023, 9:26 PMChrimaeon
12/26/2023, 9:35 PM