HTML API: Fix logic bug in HTML Processor when opening A element.

A mistake in the original code handling opening A elements in the HTML Processor led to mistakes in parsing where the Processor would bail in situations when it could have proceeded. While this was errant behavior, it didn't violate the public contract since it would bail in these situations.

This patch fixes the mistake, which was to only break out of the innermost loop instead of breaking from the containing loop, which resolves the issue.

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

Follow-up to [56274].

Props jonsurrell.
See #61576.

Built from https://develop.svn.wordpress.org/trunk@58966


git-svn-id: http://core.svn.wordpress.org/trunk@58362 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dmsnell 2024-09-02 21:54:15 +00:00
parent 3e8d4ddc1d
commit d7f9d30df8
2 changed files with 3 additions and 3 deletions

View File

@ -2352,13 +2352,13 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
foreach ( $this->state->active_formatting_elements->walk_up() as $item ) { foreach ( $this->state->active_formatting_elements->walk_up() as $item ) {
switch ( $item->node_name ) { switch ( $item->node_name ) {
case 'marker': case 'marker':
break; break 2;
case 'A': case 'A':
$this->run_adoption_agency_algorithm(); $this->run_adoption_agency_algorithm();
$this->state->active_formatting_elements->remove_node( $item ); $this->state->active_formatting_elements->remove_node( $item );
$this->state->stack_of_open_elements->remove_node( $item ); $this->state->stack_of_open_elements->remove_node( $item );
break; break 2;
} }
} }

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.7-alpha-58965'; $wp_version = '6.7-alpha-58966';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.