yew/packages/yew-macro/tests/html_macro/dyn-element-pass.rs
Simon 37401402a1
Allow the use of Rust keywords for element names (#1772)
* time for more hygiene

* update corresponding tests

* while I'm at it

* now let's fix the actual issue

* fix the publish examples CI while I'm at it

* resolve clippy warnings
2021-02-28 15:49:58 +01:00

28 lines
671 B
Rust

#![no_implicit_prelude]
fn main() {
let dyn_tag = || ::std::string::ToString::to_string("test");
let mut next_extra_tag = {
let mut it = ::std::iter::IntoIterator::into_iter(::std::vec!["a", "b"]);
move || ::std::option::Option::unwrap(::std::iter::Iterator::next(&mut it))
};
::yew::html! {
<@{ dyn_tag() }>
<@{ next_extra_tag() } class="extra-a"/>
<@{ next_extra_tag() } class="extra-b"/>
</@>
};
::yew::html! {
<@{
let tag = dyn_tag();
if tag == "test" {
"div"
} else {
"a"
}
}/>
};
}