[wp-trac] [WordPress Trac] #61545: HTML API: Performance Improvements for 6.7

WordPress Trac noreply at wordpress.org
Tue Aug 13 13:58:54 UTC 2024


#61545: HTML API: Performance Improvements for 6.7
--------------------------------------+--------------------------
 Reporter:  dmsnell                   |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  6.7
Component:  HTML API                  |     Version:  6.6
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+--------------------------

Comment (by westonruter):

 I
 [https://github.com/WordPress/performance/pull/1450#issuecomment-2286284940
 found] that r58613 caused a regression. Namely, it is only considering the
 initial letter of a tag name when doing a `next_tag()` call with a
 `tag_name` query. For example:

 {{{#!php
 <?php
 $picture_markup = '<p><img width="1024" height="683"
 src="http://localhost:8889/wp-
 content/uploads/2024/08/leaves-232-1024x683.webp" class="wp-image-9"
 alt="Green Leaves" decoding="async" loading="lazy"
 srcset="http://localhost:8889/wp-
 content/uploads/2024/08/leaves-232-1024x683.webp 1024w,
 http://localhost:8889/wp-content/uploads/2024/08/leaves-232-300x200.webp
 300w, http://localhost:8889/wp-
 content/uploads/2024/08/leaves-232-768x512.webp 768w,
 http://localhost:8889/wp-content/uploads/2024/08/leaves-232-jpg.webp
 1080w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>';
 $picture_processor = new WP_HTML_Tag_Processor( $picture_markup );
 var_dump( $picture_processor->next_tag( array( 'tag_name' => 'picture' ) )
 );
 var_dump( $picture_processor->get_tag() );
 }}}

 This unexpectedly outputs even though there is no `PICTURE` tag in the
 input:

 {{{
 bool(true)
 string(1) "P"
 }}}


 If I remove the `P` tag, then it outputs as expected:


 {{{
 bool(false)
 NULL
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61545#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list