From 0e284447951869fd3ff58b345ec070b0ab97d9bc Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 26 Dec 2023 14:22:45 +0000 Subject: [PATCH] KSES: Add `background-repeat` to the list of safe CSS properties. Follow-up to [45242], [46235]. Props andrewserong, ramonopoly, mukesh27. Fixes #60132. git-svn-id: https://develop.svn.wordpress.org/trunk@57228 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/kses.php | 2 ++ tests/phpunit/tests/kses.php | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php index 026e00412499f..cccb1768c2dfd 100644 --- a/src/wp-includes/kses.php +++ b/src/wp-includes/kses.php @@ -2303,6 +2303,7 @@ function kses_init() { * @since 6.3.0 Extended support for `filter` to accept a URL and added support for repeat(). * Added support for `box-shadow`. * @since 6.4.0 Added support for `writing-mode`. + * @since 6.5.0 Added support for `background-repeat`. * * @param string $css A string of CSS rules. * @param string $deprecated Not used. @@ -2334,6 +2335,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) { 'background-color', 'background-image', 'background-position', + 'background-repeat', 'background-size', 'background-attachment', 'background-blend-mode', diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php index 51fcab74b6de0..1dbe5b2587bc4 100644 --- a/tests/phpunit/tests/kses.php +++ b/tests/phpunit/tests/kses.php @@ -938,6 +938,8 @@ public function test_wp_kses_attr_no_attributes_allowed_with_false() { * @ticket 55966 * @ticket 56122 * @ticket 58551 + * @ticket 60132 + * * @dataProvider data_safecss_filter_attr * * @param string $css A string of CSS rules. @@ -1346,6 +1348,11 @@ public function data_safecss_filter_attr() { 'css' => 'writing-mode: vertical-rl', 'expected' => 'writing-mode: vertical-rl', ), + // `background-repeat` introduced in 6.5. + array( + 'css' => 'background-repeat: no-repeat', + 'expected' => 'background-repeat: no-repeat', + ), ); }