Changeset 56812
- Timestamp:
- 10/10/2023 03:41:38 AM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json.php
r56778 r56812 1147 1147 $parts = explode( '&', $css ); 1148 1148 foreach ( $parts as $part ) { 1149 $processed_css .= ( ! str_contains( $part, '{' ) ) 1150 ? trim( $selector ) . '{' . trim( $part ) . '}' // If the part doesn't contain braces, it applies to the root level. 1151 : trim( $selector . $part ); // Prepend the selector, which effectively replaces the "&" character. 1149 $is_root_css = ( ! str_contains( $part, '{' ) ); 1150 if ( $is_root_css ) { 1151 // If the part doesn't contain braces, it applies to the root level. 1152 $processed_css .= trim( $selector ) . '{' . trim( $part ) . '}'; 1153 } else { 1154 // If the part contains braces, it's a nested CSS rule. 1155 $part = explode( '{', str_replace( '}', '', $part ) ); 1156 if ( count( $part ) !== 2 ) { 1157 continue; 1158 } 1159 $nested_selector = $part[0]; 1160 $css_value = $part[1]; 1161 $part_selector = str_starts_with( $nested_selector, ' ' ) 1162 ? static::scope_selector( $selector, $nested_selector ) 1163 : static::append_to_selector( $selector, $nested_selector ); 1164 $processed_css .= $part_selector . '{' . trim( $css_value ) . '}'; 1165 } 1152 1166 } 1153 1167 return $processed_css;
Note: See TracChangeset
for help on using the changeset viewer.