From d160f38bc29621baf3d41cf3d9a15b3ea3182510 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Mon, 12 Dec 2022 11:18:36 -0800 Subject: [PATCH] fix: parsing of attributes without trailing commas --- examples/svg_basic.rs | 6 ++++++ packages/rsx/src/element.rs | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/svg_basic.rs b/examples/svg_basic.rs index e950eb339..1264aa001 100644 --- a/examples/svg_basic.rs +++ b/examples/svg_basic.rs @@ -67,6 +67,12 @@ fn app(cx: Scope) -> Element { stroke: "blue", stroke_width: "5", } + path { + d: "M9.00001 9C9 62 103.5 124 103.5 178", + stroke: "#3CC4DC", + "stroke-linecap": "square", + "stroke-width": "square", + } })) } diff --git a/packages/rsx/src/element.rs b/packages/rsx/src/element.rs index 307059f9d..ae4bfabe9 100644 --- a/packages/rsx/src/element.rs +++ b/packages/rsx/src/element.rs @@ -45,7 +45,7 @@ impl Parse for Element { content.parse::()?; - if content.peek(LitStr) && content.peek2(Token![,]) { + if content.peek(LitStr) { let value = content.parse()?; attributes.push(ElementAttrNamed { el_name: el_name.clone(), @@ -53,7 +53,6 @@ impl Parse for Element { }); } else { let value = content.parse::()?; - attributes.push(ElementAttrNamed { el_name: el_name.clone(), attr: ElementAttr::CustomAttrExpression { name, value },