Skip to content

Commit

Permalink
Update attribute.go
Browse files Browse the repository at this point in the history
  • Loading branch information
maxence-charriere committed Jun 20, 2022
1 parent 4c1395b commit 9db2a4e
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions pkg/app/attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,15 @@ type attributes map[string]string
func (a attributes) Set(name string, value any) {
switch name {
case "style", "allow":
var b strings.Builder
b.WriteString(a[name])
b.WriteString(toAttributeValue(value))
b.WriteByte(';')
a[name] = b.String()
a[name] += toAttributeValue(value) + ";"

case "class":
var b strings.Builder
b.WriteString(a[name])
if b.Len() != 0 {
b.WriteByte(' ')
s := a[name]
if s != "" {
s += " "
}
b.WriteString(toAttributeValue(value))
a[name] = b.String()
s += toAttributeValue(value)
a[name] = s

default:
a[name] = toAttributeValue(value)
Expand Down

0 comments on commit 9db2a4e

Please sign in to comment.