1
0

Add video element and related attributes (#84)

Adds the `video` element and `loop`, `muted`, `playsinline`, `poster` attributes.
This commit is contained in:
Markus Wüstenberg 2021-06-18 09:39:47 +02:00 committed by GitHub
parent 0efc71d6f3
commit ec86ca5c71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 15 deletions

View File

@ -28,10 +28,22 @@ func Disabled() g.Node {
return g.Attr("disabled") return g.Attr("disabled")
} }
func Loop() g.Node {
return g.Attr("loop")
}
func Multiple() g.Node { func Multiple() g.Node {
return g.Attr("multiple") return g.Attr("multiple")
} }
func Muted() g.Node {
return g.Attr("muted")
}
func PlaysInline() g.Node {
return g.Attr("playsinline")
}
func ReadOnly() g.Node { func ReadOnly() g.Node {
return g.Attr("readonly") return g.Attr("readonly")
} }
@ -142,14 +154,18 @@ func Pattern(v string) g.Node {
return g.Attr("pattern", v) return g.Attr("pattern", v)
} }
func Preload(v string) g.Node {
return g.Attr("preload", v)
}
func Placeholder(v string) g.Node { func Placeholder(v string) g.Node {
return g.Attr("placeholder", v) return g.Attr("placeholder", v)
} }
func Poster(v string) g.Node {
return g.Attr("poster", v)
}
func Preload(v string) g.Node {
return g.Attr("preload", v)
}
func Rel(v string) g.Node { func Rel(v string) g.Node {
return g.Attr("rel", v) return g.Attr("rel", v)
} }

View File

@ -11,16 +11,19 @@ import (
func TestBooleanAttributes(t *testing.T) { func TestBooleanAttributes(t *testing.T) {
cases := map[string]func() g.Node{ cases := map[string]func() g.Node{
"async": Async, "async": Async,
"autofocus": AutoFocus, "autofocus": AutoFocus,
"autoplay": AutoPlay, "autoplay": AutoPlay,
"controls": Controls, "controls": Controls,
"defer": Defer, "defer": Defer,
"disabled": Disabled, "disabled": Disabled,
"multiple": Multiple, "loop": Loop,
"readonly": ReadOnly, "multiple": Multiple,
"required": Required, "muted": Muted,
"selected": Selected, "playsinline": PlaysInline,
"readonly": ReadOnly,
"required": Required,
"selected": Selected,
} }
for name, fn := range cases { for name, fn := range cases {
@ -55,8 +58,9 @@ func TestSimpleAttributes(t *testing.T) {
"minlength": MinLength, "minlength": MinLength,
"name": Name, "name": Name,
"pattern": Pattern, "pattern": Pattern,
"preload": Preload,
"placeholder": Placeholder, "placeholder": Placeholder,
"poster": Poster,
"preload": Preload,
"rel": Rel, "rel": Rel,
"role": Role, "role": Role,
"rows": Rows, "rows": Rows,

View File

@ -426,3 +426,7 @@ func U(children ...g.Node) g.Node {
func Var(children ...g.Node) g.Node { func Var(children ...g.Node) g.Node {
return g.El("var", g.Group(children)) return g.El("var", g.Group(children))
} }
func Video(children ...g.Node) g.Node {
return g.El("video", g.Group(children))
}

View File

@ -118,6 +118,7 @@ func TestSimpleElements(t *testing.T) {
"u": U, "u": U,
"ul": Ul, "ul": Ul,
"var": Var, "var": Var,
"video": Video,
} }
for name, fn := range cases { for name, fn := range cases {