Make WordPress Core

Changeset 58681


Ignore:
Timestamp:
07/06/2024 10:18:03 AM (8 months ago)
Author:
dmsnell
Message:

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

Previously the HTML Processor was ignoring the tag_name argument in
the next_tag() query if it existed. This was wrong adn would lead to
calling code finding the very next tag, regardless of tag name, instead
of the requested taag.

This patch adds the tag name detection code into next_tag() to fix
the bug and ensure that next_tag() always returns only when finding
a tag of the given name.

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

Follow-up to [56274].

Fixes #61581.

File:
1 edited

Legend:

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

    r58679 r58681  
    467467                }
    468468
     469                if ( isset( $query['tag_name'] ) && $query['tag_name'] !== $this->get_token_name() ) {
     470                    continue;
     471                }
     472
    469473                if ( isset( $needs_class ) && ! $this->has_class( $needs_class ) ) {
    470474                    continue;
Note: See TracChangeset for help on using the changeset viewer.