From 0ee0c46e4e9e469312eb042276e4ac576fbcb26e Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Thu, 2 May 2024 12:58:28 +1000 Subject: [PATCH 1/2] Global Styles: Update util for scoping CSS selectors --- src/wp-includes/class-wp-theme-json.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 39e3581c18765..aa1057098a25f 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -1764,12 +1764,17 @@ protected static function compute_preset_classes( $settings, $selector, $origins * * * @since 5.9.0 + * @since 6.6.0 Add early return if missing scope or selector. * * @param string $scope Selector to scope to. * @param string $selector Original selector. * @return string Scoped selector. */ public static function scope_selector( $scope, $selector ) { + if ( ! $scope || ! $selector ) { + return $selector; + } + $scopes = explode( ',', $scope ); $selectors = explode( ',', $selector ); From 797a3df7496a9e799b3e3f1f42ca327b8f9603ac Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Thu, 2 May 2024 10:01:33 +0200 Subject: [PATCH 2/2] Small docblock change for better consistency We try to more consistently use "Added" instead of "Add" in `since` mentions. See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#docblock-formatting:~:text=%40since%203.8.0%20Added%20the%20%60post__in%60%20argument. --- src/wp-includes/class-wp-theme-json.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index aa1057098a25f..4a333d30064ed 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -1764,7 +1764,7 @@ protected static function compute_preset_classes( $settings, $selector, $origins * * * @since 5.9.0 - * @since 6.6.0 Add early return if missing scope or selector. + * @since 6.6.0 Added early return if missing scope or selector. * * @param string $scope Selector to scope to. * @param string $selector Original selector.