aboutsummaryrefslogtreecommitdiff
path: root/formatter/formatter.go
diff options
context:
space:
mode:
Diffstat (limited to 'formatter/formatter.go')
-rw-r--r--formatter/formatter.go5
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 {