From ba8cbdf407c09e5c2fbd8295a6ec281ba16cb588 Mon Sep 17 00:00:00 2001 From: ramonjd Date: Fri, 14 Oct 2022 15:18:41 +1100 Subject: [PATCH] Backports the changes to kses.php in Core that made it into 6.1: KSES: Allow min(), max(), minmax(), and clamp() values to be used in inline CSS https://github.com/WordPress/wordpress-develop/commit/cb6f447d52e59a74c229c82ea8d3ca7efb81884d --- lib/compat/wordpress-6.1/blocks.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/compat/wordpress-6.1/blocks.php b/lib/compat/wordpress-6.1/blocks.php index b22fb1fe18aee..b8f70f50aa44c 100644 --- a/lib/compat/wordpress-6.1/blocks.php +++ b/lib/compat/wordpress-6.1/blocks.php @@ -38,11 +38,12 @@ function gutenberg_safe_style_attrs_6_1( $attrs ) { */ function gutenberg_safecss_filter_attr_allow_css_6_1( $allow_css, $css_test_string ) { if ( false === $allow_css ) { - // Allow some CSS functions. - $css_test_string = preg_replace( '/\b(?:calc|min|max|minmax|clamp)\(((?:\([^()]*\)?|[^()])*)\)/', '', $css_test_string ); - - // Allow CSS var. - $css_test_string = preg_replace( '/\(?var\(--[\w\-\()[\]\,\s]*\)/', '', $css_test_string ); + // Allows some CSS functions and CSS vars. + $css_test_string = preg_replace( + '/\b(?:var|calc|min|max|minmax|clamp)(\((?:[^()]|(?1))*\))/', + '', + $css_test_string + ); // Check for any CSS containing \ ( & } = or comments, // except for url(), calc(), or var() usage checked above.