Skip to content

Commit eeb121d

Browse files
committed
PICKME: Ensure that nodes are correctly processed in HTML content
This condition: > Reprocess the token according to the rules given in the section > corresponding to the current insertion mode in HTML content. Was resulting in an infinite loop in fragment cases. In full documents, after popping nodes the context is always moved so that foreign content parsing is not used. This is not guaranteed in a fragment and could cause an infinite loop.
1 parent 341b02f commit eeb121d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/wp-includes/html-api/class-wp-html-processor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4557,7 +4557,7 @@ private function step_in_foreign_content(): bool {
45574557

45584558
$this->state->stack_of_open_elements->pop();
45594559
}
4560-
return $this->step( self::REPROCESS_CURRENT_NODE );
4560+
goto in_foreign_content_process_in_current_insertion_mode;
45614561
}
45624562

45634563
/*
@@ -4633,6 +4633,7 @@ private function step_in_foreign_content(): bool {
46334633
goto in_foreign_content_end_tag_loop;
46344634
}
46354635

4636+
in_foreign_content_process_in_current_insertion_mode:
46364637
switch ( $this->state->insertion_mode ) {
46374638
case WP_HTML_Processor_State::INSERTION_MODE_INITIAL:
46384639
return $this->step_initial();

0 commit comments

Comments
 (0)