From f29224415a39d1730c0a4b2ca2504d74db556efe Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Fri, 29 Nov 2024 19:28:11 -0500 Subject: [PATCH] fix: sort tuple-syntax class and style in addition to colon-syntax (closes #3296) (#3303) --- leptos_macro/src/view/mod.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/leptos_macro/src/view/mod.rs b/leptos_macro/src/view/mod.rs index 8b038f945e..02428d5283 100644 --- a/leptos_macro/src/view/mod.rs +++ b/leptos_macro/src/view/mod.rs @@ -652,6 +652,18 @@ pub(crate) fn element_to_tokens( }, _ => None, }; + + if let NodeAttribute::Attribute(a) = a { + if let Some(Tuple(_)) = a.value() { + return Ordering::Greater; + } + } + if let NodeAttribute::Attribute(b) = b { + if let Some(Tuple(_)) = b.value() { + return Ordering::Less; + } + } + match (key_a.as_deref(), key_b.as_deref()) { (Some("class"), Some("class")) | (Some("style"), Some("style")) => { Ordering::Equal @@ -1710,7 +1722,7 @@ fn tuple_name(name: &str, node: &KeyedAttribute) -> TupleName { TupleName::None } -#[derive(Debug)] +#[derive(Debug, PartialEq, Eq)] enum TupleName { None, Str(String),