From b7261d8f1eee71155a07716f3b733903a42160ee Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Fri, 5 Aug 2022 14:19:01 +1000 Subject: [PATCH] Remove display handling --- .../class-wp-style-engine-css-declarations.php | 7 ------- .../class-wp-style-engine-css-declarations-test.php | 4 +--- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/style-engine/class-wp-style-engine-css-declarations.php b/packages/style-engine/class-wp-style-engine-css-declarations.php index b58e1f3dbb0071..6d2693648ae169 100644 --- a/packages/style-engine/class-wp-style-engine-css-declarations.php +++ b/packages/style-engine/class-wp-style-engine-css-declarations.php @@ -124,13 +124,6 @@ public function get_declarations() { */ protected static function filter_declaration( $property, $value, $spacer = '' ) { if ( isset( $property ) && isset( $value ) && '' === trim( $spacer ) ) { - // Allow a controlled set of `display` values. - if ( - 'display' === $property && - in_array( $value, array( 'block', 'inline', 'inline-block', 'flex', 'inline-flex', 'grid', 'inline-grid' ), true ) - ) { - return "{$property}:{$spacer}{$value}"; - } return safecss_filter_attr( "{$property}:{$spacer}{$value}" ); } return ''; diff --git a/packages/style-engine/phpunit/class-wp-style-engine-css-declarations-test.php b/packages/style-engine/phpunit/class-wp-style-engine-css-declarations-test.php index a739d300a03a69..7df4a2c5d82573 100644 --- a/packages/style-engine/phpunit/class-wp-style-engine-css-declarations-test.php +++ b/packages/style-engine/phpunit/class-wp-style-engine-css-declarations-test.php @@ -150,7 +150,6 @@ public function test_generate_prettified_with_more_indents_css_declarations_stri public function test_remove_unsafe_properties_and_values() { $input_declarations = array( 'color' => '', - 'display' => 'none', 'margin-right' => '10em', 'potato' => 'uppercase', ); @@ -167,7 +166,6 @@ public function test_remove_unsafe_properties_and_values() { */ public function test_allow_particular_css_functions() { $input_declarations = array( - 'display' => 'flex', 'background' => 'var(--wp--preset--color--primary, 10px)', // Simple var(). 'font-size' => 'clamp(36.00rem, calc(32.00rem + 10.00vw), 40.00rem)', // Nested clamp(). 'width' => 'min(150vw, 100px)', @@ -181,7 +179,7 @@ public function test_allow_particular_css_functions() { $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations ); $this->assertSame( - 'display:flex;background:var(--wp--preset--color--primary, 10px);font-size:clamp(36.00rem, calc(32.00rem + 10.00vw), 40.00rem);width:min(150vw, 100px);min-width:max(150vw, 100px);max-width:minmax(400px, 50%);padding:calc(80px * -1);background-image:url("https://wordpress.org");', + 'background:var(--wp--preset--color--primary, 10px);font-size:clamp(36.00rem, calc(32.00rem + 10.00vw), 40.00rem);width:min(150vw, 100px);min-width:max(150vw, 100px);max-width:minmax(400px, 50%);padding:calc(80px * -1);background-image:url("https://wordpress.org");', $css_declarations->get_declarations_string() ); }