Skip to content

Commit 439b39f

Browse files
Apply suggestions from code review
Co-authored-by: Weston Ruter <westonruter@gmail.com>
1 parent 68c4f7e commit 439b39f

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/wp-includes/block-supports/custom-css.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
* @return array The same parsed block with custom CSS class name added if appropriate.
1515
*/
1616
function wp_render_custom_css_support_styles( $parsed_block ) {
17-
// Check if the custom CSS attribute even exists.
18-
$custom_css = $parsed_block['attrs']['style']['css'] ?? '';
17+
$custom_css = trim( $parsed_block['attrs']['style']['css'] ?? '' );
1918

20-
if ( empty( trim( $custom_css ) ) ) {
19+
if ( empty( $custom_css ) ) {
2120
return $parsed_block;
2221
}
2322

@@ -81,7 +80,6 @@ function wp_enqueue_block_custom_css() {
8180
function wp_render_custom_css_class_name( $block_content, $block ) {
8281
$class_string = $block['attrs']['className'] ?? '';
8382

84-
/* If there is no class string, there is no custom CSS class to add, so return early. */
8583
if ( '' === $class_string ) {
8684
return $block_content;
8785
}

0 commit comments

Comments
 (0)