[wp-trac] [WordPress Trac] #64531: assertEqualHTML may ignore leading whitespace text

WordPress Trac noreply at wordpress.org
Tue Jan 20 10:06:23 UTC 2026


#64531: assertEqualHTML may ignore leading whitespace text
------------------------------+-----------------------------
 Reporter:  jonsurrell        |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:  6.9
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 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"
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64531>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list