Skip to content

Commit

Permalink
Revert "Fix tags with closing tag not visited"
Browse files Browse the repository at this point in the history
This reverts commit d11ebce.
  • Loading branch information
SantosGuillamot committed Mar 12, 2024
1 parent c6433dd commit c5d4457
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/wp-includes/interactivity-api/class-wp-interactivity-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,22 +246,20 @@ private function process_directives_args( string $html, array &$context_stack, a
}

if ( $p->is_tag_closer() ) {
if ( $p->has_and_visits_its_closer_tag() ) {
list( $opening_tag_name, $directives_prefixes ) = end( $tag_stack );

if ( 0 === count( $tag_stack ) || $opening_tag_name !== $tag_name ) {

/*
* If the tag stack is empty or the matching opening tag is not the
* same than the closing tag, it means the HTML is unbalanced and it
* stops processing it.
*/
$unbalanced = true;
break;
} else {
// Remove the last tag from the stack.
array_pop( $tag_stack );
}
list( $opening_tag_name, $directives_prefixes ) = end( $tag_stack );

if ( 0 === count( $tag_stack ) || $opening_tag_name !== $tag_name ) {

/*
* If the tag stack is empty or the matching opening tag is not the
* same than the closing tag, it means the HTML is unbalanced and it
* stops processing it.
*/
$unbalanced = true;
break;
} else {
// Remove the last tag from the stack.
array_pop( $tag_stack );
}
} else {
if ( 0 !== count( $p->get_attribute_names_with_prefix( 'data-wp-each-child' ) ) ) {
Expand Down

0 comments on commit c5d4457

Please sign in to comment.