all repos — gomponents @ 02d963de1090382d820aa371fd265452f5e5542c

HTML components in pure Go

Don't render twice with children (#9)

Markus Wüstenberg markus@maragu.dk
Mon, 21 Sep 2020 11:14:37 +0200
commit

02d963de1090382d820aa371fd265452f5e5542c

parent

4d9f1c2aedf43dbd0989f4c8165a18ed6a5a33ed

1 files changed, 3 insertions(+), 4 deletions(-)

jump to
M gomponents.gogomponents.go
@@ -45,12 +45,11 @@ return b.String() 		}
 
 		for _, c := range children {
-			s := c.Render()
 			if _, ok := c.(attr); ok {
-				attrString.WriteString(s)
-				continue
+				attrString.WriteString(c.Render())
+			} else {
+				childrenString.WriteString(c.Render())
 			}
-			childrenString.WriteString(c.Render())
 		}
 
 		b.WriteString(attrString.String())