From afd636466c4ffe560f037e328fb6359e058534a5 Mon Sep 17 00:00:00 2001 From: David Baumwald Date: Mon, 24 Oct 2022 15:56:05 +0000 Subject: [PATCH] Media: Add `object-fit` to the allowed list of CSS properties. This resolves a bug in Featured Image blocks where `object-fit` was being removed during the `render_callback`. Props raduiason, pbiron, kebbet, SergeyBiryukov, bernhard-reiter, ironprogrammer, xknown, audrasjb, ckanderson22, ivanjeronimo, seriouslysenpai. Reviewed by SergeyBiryukov. Merges [54675] to the 6.1 branch. Fixes #56855. git-svn-id: https://develop.svn.wordpress.org/branches/6.1@54676 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/kses.php | 1 + tests/phpunit/tests/kses.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php index 5dddfd023e..cdb9f61516 100644 --- a/src/wp-includes/kses.php +++ b/src/wp-includes/kses.php @@ -2389,6 +2389,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) { 'direction', 'float', 'list-style-type', + 'object-fit', 'object-position', 'overflow', 'vertical-align', diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php index 7ec4a660ed..47fbed0c2d 100644 --- a/tests/phpunit/tests/kses.php +++ b/tests/phpunit/tests/kses.php @@ -1107,6 +1107,11 @@ EOF; 'css' => 'background: conic-gradient(at 0% 30%, red 10%, yellow 30%, #1e90ff 50%)', 'expected' => 'background: conic-gradient(at 0% 30%, red 10%, yellow 30%, #1e90ff 50%)', ), + // `object-fit` introduced in 6.1. + array( + 'css' => 'object-fit: cover', + 'expected' => 'object-fit: cover', + ), // Expressions are not allowed. array( 'css' => 'height: expression( body.scrollTop + 50 + "px" )',