Skip to content

Commit cf4ed4b

Browse files
authored
yew-macro: fix inability to set the autoplay atribute (#1866)
1 parent 70bb14b commit cf4ed4b

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

packages/yew-macro/src/props/element.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ lazy_static! {
8585
vec![
8686
"async",
8787
"autofocus",
88+
"autoplay",
8889
"controls",
8990
"default",
9091
"defer",

packages/yew-macro/tests/html_macro/html-block-fail.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ error[E0277]: `()` doesn't implement `std::fmt::Display`
3434
15 | <>{ for (0..3).map(|_| not_tree()) }</>
3535
| ^^^^^^ `()` cannot be formatted with the default formatter
3636
|
37-
::: $WORKSPACE/packages/yew/src/utils.rs
37+
::: $WORKSPACE/packages/yew/src/utils.rs:76:8
3838
|
39-
| T: Into<R>,
39+
76 | T: Into<R>,
4040
| ------- required by this bound in `into_node_iter`
4141
|
4242
= help: the trait `std::fmt::Display` is not implemented for `()`

packages/yew-macro/tests/html_macro/html-element-fail.stderr

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ error[E0277]: the trait bound `(): IntoPropValue<Option<Cow<'static, str>>>` is
202202
45 | html! { <a href=() /> };
203203
| ^^ the trait `IntoPropValue<Option<Cow<'static, str>>>` is not implemented for `()`
204204
|
205-
::: $WORKSPACE/packages/yew/src/virtual_dom/mod.rs
205+
::: $WORKSPACE/packages/yew/src/virtual_dom/mod.rs:69:47
206206
|
207-
| pub fn new(key: &'static str, value: impl IntoOptPropValue<AttrValue>) -> Self {
207+
69 | pub fn new(key: &'static str, value: impl IntoOptPropValue<AttrValue>) -> Self {
208208
| --------------------------- required by this bound in `PositionalAttr::new`
209209
|
210210
= note: required because of the requirements on the impl of `IntoOptPropValue<Cow<'static, str>>` for `()`
@@ -215,9 +215,9 @@ error[E0277]: the trait bound `NotToString: IntoPropValue<Option<Cow<'static, st
215215
46 | html! { <input string=NotToString /> };
216216
| ^^^^^^^^^^^ the trait `IntoPropValue<Option<Cow<'static, str>>>` is not implemented for `NotToString`
217217
|
218-
::: $WORKSPACE/packages/yew/src/virtual_dom/mod.rs
218+
::: $WORKSPACE/packages/yew/src/virtual_dom/mod.rs:69:47
219219
|
220-
| pub fn new(key: &'static str, value: impl IntoOptPropValue<AttrValue>) -> Self {
220+
69 | pub fn new(key: &'static str, value: impl IntoOptPropValue<AttrValue>) -> Self {
221221
| --------------------------- required by this bound in `PositionalAttr::new`
222222
|
223223
= note: required because of the requirements on the impl of `IntoOptPropValue<Cow<'static, str>>` for `NotToString`
@@ -228,9 +228,9 @@ error[E0277]: the trait bound `Option<NotToString>: IntoPropValue<Option<Cow<'st
228228
47 | html! { <a media=Some(NotToString) /> };
229229
| ^^^^^^^^^^^^^^^^^ the trait `IntoPropValue<Option<Cow<'static, str>>>` is not implemented for `Option<NotToString>`
230230
|
231-
::: $WORKSPACE/packages/yew/src/virtual_dom/mod.rs
231+
::: $WORKSPACE/packages/yew/src/virtual_dom/mod.rs:69:47
232232
|
233-
| pub fn new(key: &'static str, value: impl IntoOptPropValue<AttrValue>) -> Self {
233+
69 | pub fn new(key: &'static str, value: impl IntoOptPropValue<AttrValue>) -> Self {
234234
| --------------------------- required by this bound in `PositionalAttr::new`
235235
|
236236
= note: required because of the requirements on the impl of `IntoOptPropValue<Cow<'static, str>>` for `Option<NotToString>`
@@ -241,9 +241,9 @@ error[E0277]: the trait bound `Option<{integer}>: IntoPropValue<Option<Cow<'stat
241241
48 | html! { <a href=Some(5) /> };
242242
| ^^^^^^^ the trait `IntoPropValue<Option<Cow<'static, str>>>` is not implemented for `Option<{integer}>`
243243
|
244-
::: $WORKSPACE/packages/yew/src/virtual_dom/mod.rs
244+
::: $WORKSPACE/packages/yew/src/virtual_dom/mod.rs:69:47
245245
|
246-
| pub fn new(key: &'static str, value: impl IntoOptPropValue<AttrValue>) -> Self {
246+
69 | pub fn new(key: &'static str, value: impl IntoOptPropValue<AttrValue>) -> Self {
247247
| --------------------------- required by this bound in `PositionalAttr::new`
248248
|
249249
= note: required because of the requirements on the impl of `IntoOptPropValue<Cow<'static, str>>` for `Option<{integer}>`
@@ -254,9 +254,9 @@ error[E0277]: the trait bound `{integer}: IntoPropValue<Option<yew::Callback<Mou
254254
51 | html! { <input onclick=1 /> };
255255
| ^ the trait `IntoPropValue<Option<yew::Callback<MouseEvent>>>` is not implemented for `{integer}`
256256
|
257-
::: $WORKSPACE/packages/yew/src/html/listener/listener_web_sys.rs
257+
::: $WORKSPACE/packages/yew/src/html/listener/listener_web_sys.rs:2:1
258258
|
259-
| / impl_action! {
259+
2 | / impl_action! {
260260
3 | | onabort(name: "abort", event: Event) -> web_sys::Event => |_, event| { event }
261261
4 | | onauxclick(name: "auxclick", event: MouseEvent) -> web_sys::MouseEvent => |_, event| { event }
262262
5 | | onblur(name: "blur", event: FocusEvent) -> web_sys::FocusEvent => |_, event| { event }
@@ -279,9 +279,9 @@ error[E0277]: the trait bound `yew::Callback<String>: IntoPropValue<Option<yew::
279279
52 | html! { <input onclick=Callback::from(|a: String| ()) /> };
280280
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoPropValue<Option<yew::Callback<MouseEvent>>>` is not implemented for `yew::Callback<String>`
281281
|
282-
::: $WORKSPACE/packages/yew/src/html/listener/listener_web_sys.rs
282+
::: $WORKSPACE/packages/yew/src/html/listener/listener_web_sys.rs:2:1
283283
|
284-
| / impl_action! {
284+
2 | / impl_action! {
285285
3 | | onabort(name: "abort", event: Event) -> web_sys::Event => |_, event| { event }
286286
4 | | onauxclick(name: "auxclick", event: MouseEvent) -> web_sys::MouseEvent => |_, event| { event }
287287
5 | | onblur(name: "blur", event: FocusEvent) -> web_sys::FocusEvent => |_, event| { event }
@@ -298,9 +298,9 @@ error[E0277]: the trait bound `Option<{integer}>: IntoPropValue<Option<yew::Call
298298
53 | html! { <input onfocus=Some(5) /> };
299299
| ^^^^^^^ the trait `IntoPropValue<Option<yew::Callback<FocusEvent>>>` is not implemented for `Option<{integer}>`
300300
|
301-
::: $WORKSPACE/packages/yew/src/html/listener/listener_web_sys.rs
301+
::: $WORKSPACE/packages/yew/src/html/listener/listener_web_sys.rs:2:1
302302
|
303-
| / impl_action! {
303+
2 | / impl_action! {
304304
3 | | onabort(name: "abort", event: Event) -> web_sys::Event => |_, event| { event }
305305
4 | | onauxclick(name: "auxclick", event: MouseEvent) -> web_sys::MouseEvent => |_, event| { event }
306306
5 | | onblur(name: "blur", event: FocusEvent) -> web_sys::FocusEvent => |_, event| { event }

packages/yew-macro/tests/html_macro/html-element-pass.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ fn compile_pass() {
2323
<option selected=true disabled=false value="">{"Selected"}</option>
2424
<option selected=false disabled=true value="">{"Unselected"}</option>
2525
</select>
26+
<video autoplay=true controls=true />
2627
</div>
2728
<svg width="149" height="147" viewBox="0 0 149 147" fill="none" xmlns="http://www.w3.org/2000/svg">
2829
<path d="M60.5776 13.8268L51.8673 42.6431L77.7475 37.331L60.5776 13.8268Z" fill="#DEB819"/>

packages/yew-macro/tests/html_macro/html-iterable-fail.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ error[E0277]: `()` is not an iterator
7070
18 | { for () }
7171
| ^^ `()` is not an iterator
7272
|
73-
::: $WORKSPACE/packages/yew/src/utils.rs
73+
::: $WORKSPACE/packages/yew/src/utils.rs:75:9
7474
|
75-
| IT: IntoIterator<Item = T>,
75+
75 | IT: IntoIterator<Item = T>,
7676
| ---------------------- required by this bound in `into_node_iter`
7777
|
7878
= help: the trait `Iterator` is not implemented for `()`

0 commit comments

Comments
 (0)