From cf2f441515f18ed81662d52bf049f2790e6f8ffa Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 19 Sep 2023 12:28:25 +0000 Subject: [PATCH] KSES: Add `writing-mode` to the list of safe CSS properties. Original PR from Gutenberg repository: * [https://github.com/WordPress/gutenberg/pull/54581 #54581 Gutenberg Plugin: Add hook to allow `writing-mode` as a safe CSS property] Reference: [https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode MDN Web Docs: writing-mode]. Follow-up to [56605]. Props wildworks, mukesh27, poena, andrewserong. Fixes #59387. git-svn-id: https://develop.svn.wordpress.org/trunk@56617 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/kses.php | 2 ++ tests/phpunit/tests/kses.php | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php index ce21bf5bd7..27da1679e8 100644 --- a/src/wp-includes/kses.php +++ b/src/wp-includes/kses.php @@ -2301,6 +2301,7 @@ function kses_init() { * and `z-index` CSS properties. * @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`. * * @param string $css A string of CSS rules. * @param string $deprecated Not used. @@ -2461,6 +2462,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) { 'object-position', 'overflow', 'vertical-align', + 'writing-mode', 'position', 'top', diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php index a19df38626..45f2862d14 100644 --- a/tests/phpunit/tests/kses.php +++ b/tests/phpunit/tests/kses.php @@ -1341,6 +1341,11 @@ EOF; 'css' => 'grid-template-columns: repeat(4, unsupported(0, 1fr)', 'expected' => '', ), + // `writing-mode` introduced in 6.4. + array( + 'css' => 'writing-mode: vertical-rl', + 'expected' => 'writing-mode: vertical-rl', + ), ); }