Merge branch 'many_optional_attributes' into pr/atty303/1349

This commit is contained in:
Evan Almloff committed 2023-09-22 09:32:05 -05:00
commit 9e167dfdb7
16 files changed
+553 -319

No files matched your search

+18 -9
View File
@@ -36,9 +36,11 @@ pub fn rsx_node_from_html(node: &Node) -> Option<BodyNode> {
ElementAttrNamed {
el_name: el_name.clone(),
attr: ElementAttr::AttrText {
value: ifmt_from_text(value.as_deref().unwrap_or("false")),
name: ident,
attr: ElementAttr {
value: dioxus_rsx::ElementAttrValue::AttrLiteral(ifmt_from_text(
value.as_deref().unwrap_or("false"),
)),
name: dioxus_rsx::ElementAttrName::BuiltIn(ident),
},
}
})
@@ -48,9 +50,12 @@ pub fn rsx_node_from_html(node: &Node) -> Option<BodyNode> {
if !class.is_empty() {
attributes.push(ElementAttrNamed {
el_name: el_name.clone(),
attr: ElementAttr::AttrText {
name: Ident::new("class", Span::call_site()),
value: ifmt_from_text(&class),
attr: ElementAttr {
name: dioxus_rsx::ElementAttrName::BuiltIn(Ident::new(
"class",
Span::call_site(),
)),
value: dioxus_rsx::ElementAttrValue::AttrLiteral(ifmt_from_text(&class)),
},
});
}
@@ -58,9 +63,12 @@ pub fn rsx_node_from_html(node: &Node) -> Option<BodyNode> {
if let Some(id) = &el.id {
attributes.push(ElementAttrNamed {
el_name: el_name.clone(),
attr: ElementAttr::AttrText {
name: Ident::new("id", Span::call_site()),
value: ifmt_from_text(id),
attr: ElementAttr {
name: dioxus_rsx::ElementAttrName::BuiltIn(Ident::new(
"id",
Span::call_site(),
)),
value: dioxus_rsx::ElementAttrValue::AttrLiteral(ifmt_from_text(id)),
},
});
}
@@ -71,6 +79,7 @@ pub fn rsx_node_from_html(node: &Node) -> Option<BodyNode> {
name: el_name,
children,
attributes,
merged_attributes: Default::default(),
key: None,
brace: Default::default(),
extra_attributes: None,