Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow keywords after dash in element and attribute names #2820

Merged
merged 1 commit into from Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/yew-macro/src/html_tree/html_dashed_name.rs
Expand Up @@ -79,7 +79,7 @@ impl Parse for HtmlDashedName {
let name = input.call(Ident::parse_any)?;
let mut extended = Vec::new();
while input.peek(Token![-]) {
extended.push((input.parse::<Token![-]>()?, input.parse::<Ident>()?));
extended.push((input.parse::<Token![-]>()?, input.call(Ident::parse_any)?));
}

Ok(HtmlDashedName { name, extended })
Expand Down
3 changes: 3 additions & 0 deletions packages/yew-macro/tests/html_macro/html-element-pass.rs
Expand Up @@ -118,6 +118,9 @@ fn compile_pass() {
// handle misleading angle brackets
::yew::html! { <div data-val={<::std::string::String as ::std::default::Default>::default()}></div> };
::yew::html! { <div><a data-val={<::std::string::String as ::std::default::Default>::default()} /></div> };

// test for https://github.com/yewstack/yew/issues/2810
::yew::html! { <div data-type="date" data-as="calender" /> };
}

fn main() {}