From b3db0657c3815fa394acac96c7553d393b037c71 Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Wed, 27 Nov 2024 15:34:12 +0100 Subject: [PATCH] add global method to escape global animations in css modules --- src/lib.rs | 2 ++ src/properties/custom.rs | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 53a1811e..75ee0ee2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23988,6 +23988,7 @@ mod tests { r#" :global(.foo) { color: red; + animation: global(baz) 2s; } :local(.bar) { @@ -24001,6 +24002,7 @@ mod tests { indoc! {r#" .foo { color: red; + animation: baz 2s; } .EgL3uq_bar { diff --git a/src/properties/custom.rs b/src/properties/custom.rs index 40b522e8..8dfe3caf 100644 --- a/src/properties/custom.rs +++ b/src/properties/custom.rs @@ -1474,10 +1474,15 @@ impl<'i> Function<'i> { where W: std::fmt::Write, { - self.name.to_css(dest)?; - dest.write_char('(')?; - self.arguments.to_css(dest, is_custom_property)?; - dest.write_char(')') + match self.name.as_ref() { + "global" if !is_custom_property => self.arguments.to_css(dest, is_custom_property), + _ => { + self.name.to_css(dest)?; + dest.write_char('(')?; + self.arguments.to_css(dest, is_custom_property)?; + dest.write_char(')') + } + } } fn get_fallback(&self, kind: ColorFallbackKind) -> Self {