Repository: maragudk/gomponents (go)

Issue:
picture & img element improvements
Hi @markuswustenberg , I am really happy that I discovered your project here and I am excited to put it to good use and bring it to production for several of my clients.
I love Go, compiled language, type safety and the great re-usability that we get by using Go components.
I can only see one spot where some love is missing, and that is in the image elements.

I particularly make heavy use of the `picture` element and the `img` element in some sites. Some points I have noticed are:
- Missing `srcset` attribute in `picture` element
- Missing `loading` attribute in `img` element

With those 2 additions I can really bring this to all my current and future projects. If you don't have the time to implement this, I would also not mind tips on how to proceed adding this to the codebase, although I would be a bit lost and it would take some time.

Thanks in advance man! And thanks for this wonderful creation!
Greetings from NL 🇳🇱

Pull request:
Add loading and srcset HTML attributes
I am unsure if there are more changes needed for the 2 features of #85. Looking forward for your feedback.

Patch:
diff --git a/html/attributes.go b/html/attributes.go
index b670b05..5a3dc3a 100644
--- a/html/attributes.go
+++ b/html/attributes.go
@@ -126,6 +126,10 @@ func Lang(v string) g.Node {
 	return g.Attr("lang", v)
 }
 
+func Loading(v string) g.Node {
+	return g.Attr("loading", v)
+}
+
 func Max(v string) g.Node {
 	return g.Attr("max", v)
 }
@@ -182,6 +186,10 @@ func Src(v string) g.Node {
 	return g.Attr("src", v)
 }
 
+func SrcSet(v string) g.Node {
+	return g.Attr("srcset", v)
+}
+
 func StyleAttr(v string) g.Node {
 	return g.Attr("style", v)
 }


Test patch:
diff --git a/html/attributes_test.go b/html/attributes_test.go
index 1388494..76e3390 100644
--- a/html/attributes_test.go
+++ b/html/attributes_test.go
@@ -51,6 +51,7 @@ func TestSimpleAttributes(t *testing.T) {
 		"href":         Href,
 		"id":           ID,
 		"lang":         Lang,
+		"loading":      Loading,
 		"max":          Max,
 		"maxlength":    MaxLength,
 		"method":       Method,
@@ -65,6 +66,7 @@ func TestSimpleAttributes(t *testing.T) {
 		"role":         Role,
 		"rows":         Rows,
 		"src":          Src,
+		"srcset":       SrcSet,
 		"style":        StyleAttr,
 		"tabindex":     TabIndex,
 		"target":       Target,