diff options
author | Julien Tant | 2024-06-21 00:24:11 -0700 |
---|---|---|
committer | GitHub | 2024-06-21 09:24:11 +0200 |
commit | d9708f9290f723dd4424f86d300b18974e2c169b (patch) | |
tree | f4a52297acaf49921ef4f795f48f88bb002d8a12 | |
parent | dafb3daa12160c85639fedd3eacf5aaf51127c53 (diff) | |
download | gomponents-d9708f9290f723dd4424f86d300b18974e2c169b.tar.lz gomponents-d9708f9290f723dd4424f86d300b18974e2c169b.tar.zst gomponents-d9708f9290f723dd4424f86d300b18974e2c169b.zip |
Add datetime attribute (#177)
`<time>`, `<del>` and `<ins>` can receive a [`datetime`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTimeElement/dateTime) attribute
-rw-r--r-- | html/attributes.go | 4 | ||||
-rw-r--r-- | html/attributes_test.go | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/html/attributes.go b/html/attributes.go index 98d70ff..8a1d11e 100644 --- a/html/attributes.go +++ b/html/attributes.go @@ -28,6 +28,10 @@ func CrossOrigin(v string) g.Node { return g.Attr("crossorigin", v) } +func DateTime(v string) g.Node { + return g.Attr("datetime", v) +} + func Defer() g.Node { return g.Attr("defer") } diff --git a/html/attributes_test.go b/html/attributes_test.go index 0deb06c..aba185e 100644 --- a/html/attributes_test.go +++ b/html/attributes_test.go @@ -54,6 +54,7 @@ func TestSimpleAttributes(t *testing.T) { {Name: "colspan", Func: ColSpan}, {Name: "content", Func: Content}, {Name: "crossorigin", Func: CrossOrigin}, + {Name: "datetime", Func: DateTime}, {Name: "enctype", Func: EncType}, {Name: "dir", Func: Dir}, {Name: "for", Func: For}, |