[wp-trac] [WordPress Trac] #62427: HTML API: Next tag tag name query is case sensitive

WordPress Trac noreply at wordpress.org
Thu Nov 14 14:51:14 UTC 2024


#62427: HTML API: Next tag tag name query is case sensitive
--------------------------+------------------------
 Reporter:  jonsurrell    |      Owner:  jonsurrell
     Type:  defect (bug)  |     Status:  assigned
 Priority:  normal        |  Milestone:  6.7.1
Component:  HTML API      |    Version:  6.6
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+------------------------
 The HTML API `::next_tag` method accepts a `tag_name` query. The tag name
 matching should be case-insensitive. Tag names are generally UPPERCASE in
 the processors, a lower or mixed case name doesn't make much sense.

 {{{#!php
 <?php
 // This is OK
 $processor = WP_HTML_Processor::create_fragment( '<DIV>' );
 assert( $processor->next_tag( 'div' ) );

 // This is OK
 $processor = WP_HTML_Processor::create_fragment( '<DIV>' );
 assert( $processor->next_tag( array( 'breadcrumbs' => array( 'div' ) ) )
 );

 // This does not work but should
 $processor = WP_HTML_Processor::create_fragment( '<DIV>' );
 assert( $processor->next_tag( array( 'tag_name' => 'div' ) ) ); //
 AssertionError!
 }}}

 This is also supported in the tag processor case-insensitively:

 {{{#!php
 <?php
 $processor = new WP_HTML_Tag_Processor( '<section><DIV>' );
 assert( $processor->next_tag( array( 'tag_name' => 'div' ) ) );
 $processor->get_tag(); // "DIV"
 }}}

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


More information about the wp-trac mailing list