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

Commit

Permalink
fix attributes issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Oct 18, 2022
1 parent c603ef7 commit 2f02d41
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/main/kotlin/kweb/attributes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ fun Map<String, JsonPrimitive>.classes(classes: Iterable<String>, condition: Boo
return if (condition) {
val attributeValue : String? = get("class")?.content
val existing : List<String> = attributeValue?.split(' ') ?: emptyList()
val classString = if (existing.isEmpty()) {
JsonPrimitive((existing + classes).joinToString(separator = " "))
} else {
JsonPrimitive(classes.joinToString(separator = ""))
}
val classString = JsonPrimitive((existing + classes).joinToString(separator = " "))

set("class", classString)
} else {
this
Expand Down

0 comments on commit 2f02d41

Please sign in to comment.