From b3451b72b6db737acb01eaab41016663a077e455 Mon Sep 17 00:00:00 2001 From: akasunil Date: Sat, 29 Jun 2024 11:10:30 +0530 Subject: [PATCH] Add opacity as an allowed attribute to safecss_filter_attr() --- 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 0ef5803ebc7b4..3efb951a7b643 100644 --- a/src/wp-includes/kses.php +++ b/src/wp-includes/kses.php @@ -2539,6 +2539,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) { 'box-shadow', 'aspect-ratio', 'container-type', + 'opacity', // Custom CSS properties. '--*', diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php index ea65a89092c07..ec8a3bc5335a9 100644 --- a/tests/phpunit/tests/kses.php +++ b/tests/phpunit/tests/kses.php @@ -1353,6 +1353,11 @@ public function data_safecss_filter_attr() { 'css' => 'background-repeat: no-repeat', 'expected' => 'background-repeat: no-repeat', ), + // `background-repeat` introduced in 6.7. + array( + 'css' => 'opacity: 10', + 'expected' => 'opacity: 10', + ), ); }