mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-20 19:56:49 +01:00
Editor: Fix complex variation selectors when using selectors API.
Fixes a bug in the manipulation of selectors for block style variations that would result in an incorrect selector and fail to match the appropriate elements on the frontend. Props aaronrobertshaw, ramonopoly, joemcgill. Fixes #62471. Built from https://develop.svn.wordpress.org/trunk@59814 git-svn-id: http://core.svn.wordpress.org/trunk@59156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
737185823f
commit
2766df98d2
|
|
@ -2850,8 +2850,14 @@ class WP_Theme_JSON {
|
|||
|
||||
// Combine selectors with style variation's selector and add to overall style variation declarations.
|
||||
foreach ( $variation_declarations as $current_selector => $new_declarations ) {
|
||||
// If current selector includes block classname, remove it but leave the whitespace in.
|
||||
$shortened_selector = str_replace( $block_metadata['selector'] . ' ', ' ', $current_selector );
|
||||
/*
|
||||
* Clean up any whitespace between comma separated selectors.
|
||||
* This prevents these spaces breaking compound selectors such as:
|
||||
* - `.wp-block-list:not(.wp-block-list .wp-block-list)`
|
||||
* - `.wp-block-image img, .wp-block-image.my-class img`
|
||||
*/
|
||||
$clean_current_selector = preg_replace( '/,\s+/', ',', $current_selector );
|
||||
$shortened_selector = str_replace( $block_metadata['selector'], '', $clean_current_selector );
|
||||
|
||||
// Prepend the variation selector to the current selector.
|
||||
$split_selectors = explode( ',', $shortened_selector );
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.8-alpha-59813';
|
||||
$wp_version = '6.8-alpha-59814';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user