Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

Commit

Permalink
add some utility setAttributeRaw()s
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed May 15, 2021
1 parent ebf7199 commit 610438e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/kotlin/kweb/Element.kt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ open class Element(
return this
}

fun setAttributeRaw(name : String, value : String)
= setAttributeRaw(name, JsonPrimitive(value))

fun setAttributeRaw(name : String, value : Boolean)
= setAttributeRaw(name, JsonPrimitive(value))

fun setAttributeRaw(name : String, value : Number)
= setAttributeRaw(name, JsonPrimitive(value))

fun setAttribute(name: String, oValue: KVal<out JsonPrimitive>): Element {
setAttributeRaw(name, oValue.value)
val handle = oValue.addListener { _, newValue ->
Expand Down

0 comments on commit 610438e

Please sign in to comment.