Skip to content

Commit

Permalink
Set parsing namespace correctly when seeking
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Nov 6, 2024
1 parent 660dc85 commit 9a0c017
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/wp-includes/html-api/class-wp-html-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5347,7 +5347,6 @@ public function seek( $bookmark_name ): bool {
* This must be done after clearing the stack because those stacks generate events that
* would appear on a subsequent call to `next_token()`.
*/
$this->change_parsing_namespace( 'html' );
$this->state->frameset_ok = true;
$this->state->stack_of_template_insertion_modes = array();
$this->state->head_element = null;
Expand All @@ -5358,13 +5357,19 @@ public function seek( $bookmark_name ): bool {

// The presence or absence of a context node indicates a full or fragment parser.
if ( null === $this->context_node ) {
$this->change_parsing_namespace( 'html' );
$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_INITIAL;
$this->breadcrumbs = array();

$this->bytes_already_parsed = 0;
$this->parser_state = self::STATE_READY;
$this->next_token();
} else {
$this->change_parsing_namespace(
$this->context_node->integration_node_type
? 'html'
: $this->context_node->namespace
);
$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_BODY;
$this->breadcrumbs = array_slice( $this->breadcrumbs, 0, 2 );
parent::seek( $this->context_node->bookmark_name );
Expand Down

0 comments on commit 9a0c017

Please sign in to comment.