Skip to content

Commit

Permalink
Remove display handling
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong committed Aug 5, 2022
1 parent 2d0f51f commit b7261d8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' => '<red/>',
'display' => 'none',
'margin-right' => '10em',
'potato' => 'uppercase',
);
Expand All @@ -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)',
Expand All @@ -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(&quot;https://wordpress.org&quot;);',
'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(&quot;https://wordpress.org&quot;);',
$css_declarations->get_declarations_string()
);
}
Expand Down

0 comments on commit b7261d8

Please sign in to comment.