all repos — gomponents @ 33524d683661bf73fd224a76ec62fb88b2b3c767

HTML components in pure Go

Add loading and srcset HTML attributes (#86) Useful for `img` and `picture` elements. Fixes #85. Co-authored-by: Josep Jesus Bigorra Algaba <josep@prowarehouse.nl>

commit

33524d683661bf73fd224a76ec62fb88b2b3c767

parent

bd722def2798c8a5a53d0fa87755efefd146198d

2 files changed, 10 insertions(+), 0 deletions(-)

changed files
M html/attributes.gohtml/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) }
@@ -180,6 +184,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 {
M html/attributes_test.gohtml/attributes_test.go
@@ -51,6 +51,7 @@ "height": Height,
"href": Href, "id": ID, "lang": Lang, + "loading": Loading, "max": Max, "maxlength": MaxLength, "method": Method,
@@ -65,6 +66,7 @@ "rel": Rel,
"role": Role, "rows": Rows, "src": Src, + "srcset": SrcSet, "style": StyleAttr, "tabindex": TabIndex, "target": Target,