about summary refs log tree commit diff stats
path: root/attr/attributes_test.go
diff options
context:
space:
mode:
authorMarkus Wüstenberg2020-11-16 12:38:24 +0100
committerGitHub2020-11-16 12:38:24 +0100
commit794c3b26acbd3931b7973ff7e09a42b0ac414b1c (patch)
treeac909b96ce6cca65b71828deca179db8e22e2995 /attr/attributes_test.go
parent87d09c382434c9198c50356954fedf0ab8e5576f (diff)
downloadgomponents-794c3b26acbd3931b7973ff7e09a42b0ac414b1c.tar.lz
gomponents-794c3b26acbd3931b7973ff7e09a42b0ac414b1c.tar.zst
gomponents-794c3b26acbd3931b7973ff7e09a42b0ac414b1c.zip
Render correct HTML5 (#44)
Previously, elements of kind void and empty elements generally would be rendered auto-closing (with a final `/` character in the start tag), which is allowed sometimes but arguably wrong. See https://dev.w3.org/html5/spec-LC/syntax.html#end-tags

This created problems with for example `textarea` and `script`, which cannot be auto-closing, or the browser renders it wrong.

Also clarified in the docs that this library outputs HTML5.

Fixes #42.
Diffstat (limited to 'attr/attributes_test.go')
-rw-r--r--attr/attributes_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/attr/attributes_test.go b/attr/attributes_test.go
index efb7044..da04a20 100644
--- a/attr/attributes_test.go
+++ b/attr/attributes_test.go
@@ -20,7 +20,7 @@ func TestClasses(t *testing.T) {
 
 	t.Run("renders as attribute in an element", func(t *testing.T) {
 		e := g.El("div", attr.Classes{"hat": true})
-		assert.Equal(t, `<div class="hat" />`, e)
+		assert.Equal(t, `<div class="hat"></div>`, e)
 	})
 
 	t.Run("also works with fmt", func(t *testing.T) {