[wp-trac] [WordPress Trac] #64531: assertEqualHTML may ignore leading whitespace text
WordPress Trac
noreply at wordpress.org
Tue Jan 20 12:11:46 UTC 2026
#64531: assertEqualHTML may ignore leading whitespace text
--------------------------------------+---------------------
Reporter: jonsurrell | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone:
Component: Build/Test Tools | Version: 6.9
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+---------------------
Description changed by jonsurrell:
Old description:
> Some leading whitespace is trimmed from text nodes resulting in incorrect
> assertions like the following (passes, but should not):
>
> {{{#!php
> <?php
> $this->assertEqualHTML(
> "<p> x</p>",
> "<p>\nx</p>"
> );
> }}}
>
> The following tree is constructed by `build_visual_html_tree()` in both
> cases:
>
> {{{
> <p>
> "x"
> }}}
>
> The is the expected trees are:
>
> {{{
> <p>
> " x"
> }}}
> {{{
> <p>
> "
> x"
> }}}
New description:
Some leading whitespace is trimmed from text nodes resulting in incorrect
assertions like the following (passes, but should not):
{{{#!php
<?php
$this->assertEqualHTML(
"<p> x</p>",
"<p>\nx</p>"
);
}}}
The following tree is constructed by `build_visual_html_tree()` in both
cases:
{{{
<p>
"x"
}}}
The expected trees are:
{{{
<p>
" x"
}}}
{{{
<p>
"
x"
}}}
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64531#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list