Make WordPress Core


Ignore:
Timestamp:
01/27/2026 11:18:32 AM (8 months ago)
Author:
jonsurrell
Message:

Build/Test Tools: Ensure assertEqualHTML() recognizes whitespace text.

Ensure whitespace text nodes are correctly represented by build_visual_html_tree().

The build_visual_html_tree() function used by assertEqualHTML() would remove some leading whitespace from text nodes. Some whitespace-only text nodes were omitted from the tree.

Developed in https://github.com/WordPress/wordpress-develop/pull/10765.

Follow-up to [60295].

Reviewed by wildworks.
Merges [61519] to the 6.9 branch.

Props jonsurrell, dmsnell, bernhard-reiter.
Fixes #64531.

Location:
branches/6.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.9

  • branches/6.9/tests/phpunit/includes/build-visual-html-tree.php

    r60707 r61536  
    203203                        case '#text':
    204204                                $text_content = $processor->get_modifiable_text();
    205                                 if ( '' === trim( $text_content, " \f\t\r\n" ) ) {
     205                                if ( '' === $text_content ) {
    206206                                        break;
    207207                                }
     
    238238                                                }
    239239
    240                                                 // If they're no attributes, we're done here.
     240                                                // When no attributes are present, there’s nothing left to do.
    241241                                                if ( empty( $block_attrs ) ) {
    242242                                                        break;
Note: See TracChangeset for help on using the changeset viewer.