Skip to content

Commit

Permalink
Add datetime attribute (#177)
Browse files Browse the repository at this point in the history
`<time>`, `<del>` and `<ins>` can receive a
[`datetime`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTimeElement/dateTime)
attribute
  • Loading branch information
JulienTant authored Jun 21, 2024
1 parent dafb3da commit d9708f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions html/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
1 change: 1 addition & 0 deletions html/attributes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit d9708f9

Please sign in to comment.