Make WordPress Core

Changeset 58190

Timestamp:
05/23/2024 10:43:27 PM (2 months ago)
Author:
dmsnell
Message:

HTML API: Respect class_name query arg in HTML_Processor::next_tag()

Previously the HTML Process was ignoring the class_name argument in
the next_tag() query if it existed. This was wrong and would lead to
calling code finding the wrong tag if provided.

This patch adds the class detection code back into next_tag() to fix
the bug.

Developed in https://github.com/WordPress/wordpress-develop/pull/6618
Discussed in https://core.trac.wordpress.org/ticket/58517

See #58517.
Follow-up to [56274].
Props: dmsnell, jonsurrell.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/html-api/class-wp-html-processor.php

    r57806 r58190  
    387387        }
    388388
     389
     390
     391
     392
    389393        if ( ! ( array_key_exists( 'breadcrumbs', $query ) && is_array( $query['breadcrumbs'] ) ) ) {
    390394            while ( $this->step() ) {
    391395                if ( '#tag' !== $this->get_token_type() ) {
     396
     397
     398
     399
    392400                    continue;
    393401                }
     
    415423        while ( $match_offset > 0 && $this->step() ) {
    416424            if ( '#tag' !== $this->get_token_type() ) {
     425
     426
     427
     428
    417429                continue;
    418430            }
Note: See TracChangeset for help on using the changeset viewer.