From 9548eb6deb9ff3929fc0a89ca4136f7d39f3e3aa Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Mon, 17 Aug 2020 04:48:11 -0400 Subject: [PATCH] convert single quotes to double quotes in `calc` --- src/parse/value/css_function.rs | 4 ++-- tests/special-functions.rs | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/parse/value/css_function.rs b/src/parse/value/css_function.rs index fe90a18..5d60c3b 100644 --- a/src/parse/value/css_function.rs +++ b/src/parse/value/css_function.rs @@ -48,12 +48,12 @@ impl<'a> Parser<'a> { } } q @ '\'' | q @ '"' => { - buf.push(q); + buf.push('"'); match self.parse_quoted_string(q)?.node { Value::String(ref s, ..) => buf.push_str(s), _ => unreachable!(), } - buf.push(q); + buf.push('"'); } c => buf.push(c), } diff --git a/tests/special-functions.rs b/tests/special-functions.rs index 9511465..5f22f5f 100644 --- a/tests/special-functions.rs +++ b/tests/special-functions.rs @@ -59,6 +59,11 @@ test!( "a {\n color: calc(\")\");\n}\n", "a {\n color: calc(\")\");\n}\n" ); +test!( + calc_quoted_string_single_quotes, + "a {\n color: calc('a');\n}\n", + "a {\n color: calc(\"a\");\n}\n" +); test!( element_whitespace, "a {\n color: element( 1 );\n}\n",