all repos — gomponents @ 794c3b26acbd3931b7973ff7e09a42b0ac414b1c

HTML components in pure Go

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.

Markus Wüstenberg
commit

794c3b26acbd3931b7973ff7e09a42b0ac414b1c

parent

87d09c382434c9198c50356954fedf0ab8e5576f

1 file changed, 1 insertion(+), 1 deletion(-)

changed files
M attr/attributes_test.goattr/attributes_test.go
@@ -20,7 +20,7 @@ })
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) {