From b44f81bd602d20b62f673ce465da8c36939d773d Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Sat, 24 Jul 2021 01:18:36 -0400 Subject: [PATCH] newlines inside `@supports` are the same as outside --- src/output.rs | 2 +- tests/supports.rs | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/output.rs b/src/output.rs index b84a9d8..21a6c74 100644 --- a/src/output.rs +++ b/src/output.rs @@ -620,7 +620,7 @@ impl Formatter for ExpandedFormatter { } writeln!(buf, " {{")?; - let css = Css::from_stmts(body, AtRuleContext::Supports, css.allows_charset)?; + let css = Css::from_stmts(body, AtRuleContext::None, css.allows_charset)?; self.write_css(buf, css, map)?; write!(buf, "\n{}}}", padding)?; } diff --git a/tests/supports.rs b/tests/supports.rs index 9dd662e..5b091e6 100644 --- a/tests/supports.rs +++ b/tests/supports.rs @@ -27,3 +27,26 @@ test!( }", "@supports (-ms-ime-align: auto) {\n a {\n color: red;\n }\n\n b {\n color: green;\n }\n}\n" ); +test!( + no_newline_after_media, + "@supports (position: sticky) { + a { + color: red; + } + + @media (min-width: 576px) { + a { + color: red; + } + + a { + color: red; + } + } + + a { + color: red; + } + }", + "@supports (position: sticky) {\n a {\n color: red;\n }\n\n @media (min-width: 576px) {\n a {\n color: red;\n }\n\n a {\n color: red;\n }\n }\n a {\n color: red;\n }\n}\n" +);