Skip to content

Commit

Permalink
Fix the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Nov 5, 2024
1 parent dc3f1e6 commit 89aa01b
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/wp-includes/html-api/class-wp-html-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5323,15 +5323,6 @@ public function seek( $bookmark_name ): bool {
* and computation time.
*/
if ( 'backward' === $direction ) {
// Reset necessary parser state
$this->change_parsing_namespace( 'html' );
$this->state->frameset_ok = true;
$this->state->stack_of_template_insertion_modes = array();
$this->state->head_element = null;
$this->state->form_element = null;
$this->state->current_token = null;
$this->element_queue = array();
$this->current_element = null;

/*
* In case the parser is a fragment parser, instead of clearing the
Expand All @@ -5354,6 +5345,16 @@ public function seek( $bookmark_name ): bool {
$this->state->active_formatting_elements->remove_node( $item );
}

// Reset necessary parser state
$this->change_parsing_namespace( 'html' );
$this->state->frameset_ok = true;
$this->state->stack_of_template_insertion_modes = array();
$this->state->head_element = null;
$this->state->form_element = null;
$this->state->current_token = null;
$this->current_element = null;
$this->element_queue = array();

if ( null === $this->context_node ) {
$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_INITIAL;
$this->breadcrumbs = array();
Expand All @@ -5373,6 +5374,9 @@ public function seek( $bookmark_name ): bool {
}

while ( $this->next_token() ) {
if ( $this->is_virtual() ) {
continue;
}
$bm = $this->bookmarks[ $this->current_element->token->bookmark_name ];
if ( $bookmark_starts_at === $bm->start ) {
while ( isset( $this->current_element ) && WP_HTML_Stack_Event::POP === $this->current_element->operation ) {
Expand Down

0 comments on commit 89aa01b

Please sign in to comment.