Merge remember branch, Update to 0.2.5-SNAPSHOT

This commit is contained in:
2021-02-10 13:20:07 +01:00
parent 59d812613e
commit 66b3fb3c22
12 changed files with 389 additions and 143 deletions

View File

@@ -1,13 +1,13 @@
package nl.astraeus.komp
import kotlinx.browser.document
import kotlinx.html.*
import org.w3c.dom.*
import org.w3c.dom.css.CSSStyleDeclaration
import org.w3c.dom.events.Event
import kotlin.browser.document
@Suppress("NOTHING_TO_INLINE")
inline fun HTMLElement.setEvent(name: String, noinline callback: (Event) -> Unit): Unit {
inline fun HTMLElement.setEvent(name: String, noinline callback: (Event) -> Unit) {
val eventName = if (name.startsWith("on")) {
name.substring(2)
} else {
@@ -185,7 +185,7 @@ class HtmlBuilder(
throw IllegalStateException("No current DOM node")
}
// stupid hack as browsers doesn't support createEntityReference
// stupid hack as browsers don't support createEntityReference
val s = document.createElement("span") as HTMLElement
s.innerHTML = entity.text
path.last().appendChild(s.childNodes.asList().first { it.nodeType == Node.TEXT_NODE })