Make WordPress Core

Changeset 58702

Timestamp:
07/09/2024 09:43:11 PM (4 weeks ago)
Author:
dmsnell
Message:

HTML API: Correct node name in generate_implied_end_tags().

The generate_implied_end_tags() algorithm has been comparing the
current node to a list of node names, which means that it won't ever
pop any elements from the stack of open elements.

This patch corrects the mistake by comparing node name against the
list, thus fixing the algorithm. This was noted in development work
for the 6.7 release.

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

Props dmsnell, jonsurrell.
See #61576.

File:
1 edited

Legend:

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

    r58681 r58702  
    27722772        while (
    27732773            ( $no_exclusions || ! $this->state->stack_of_open_elements->current_node_is( $except_for_this_element ) ) &&
    2774             in_array( $this->state->stack_of_open_elements->current_node(), $elements_with_implied_end_tags, true )
     2774            in_array( $this->state->stack_of_open_elements->current_node(), $elements_with_implied_end_tags, true )
    27752775        ) {
    27762776            $this->state->stack_of_open_elements->pop();
     
    28122812        );
    28132813
    2814         while ( in_array( $this->state->stack_of_open_elements->current_node(), $elements_with_implied_end_tags, true ) ) {
     2814        while ( in_array( $this->state->stack_of_open_elements->current_node(), $elements_with_implied_end_tags, true ) ) {
    28152815            $this->state->stack_of_open_elements->pop();
    28162816        }
Note: See TracChangeset for help on using the changeset viewer.