diff options
Diffstat (limited to 'formatter')
-rw-r--r-- | formatter/formatter.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/formatter/formatter.go b/formatter/formatter.go index 6249c0a..7ac41a6 100644 --- a/formatter/formatter.go +++ b/formatter/formatter.go @@ -48,14 +48,17 @@ func PrintAst(ast parser.AstNode) { } func printAttrs(attrs []parser.Attr) { - classes := attrs + classes := make([]parser.Attr, len(attrs), cap(attrs)) + copy(classes, attrs) classes = slices.DeleteFunc(classes, func(a parser.Attr) bool { return a.Key != "class" }) + attrs = slices.DeleteFunc(attrs, func(a parser.Attr) bool { return a.Key == "class" }) + if len(classes) > 0 { fmt.Print(" class=\"") for i, a := range classes { |