From bd16b4a65bae2a8291d34d46a6128697071d48ba Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Sun, 4 Feb 2024 18:49:12 +0100 Subject: [PATCH] table processing --- .../html-api/class-wp-html-processor.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/html-api/class-wp-html-processor.php b/src/wp-includes/html-api/class-wp-html-processor.php index cab5c4ca4a0d8..0d410cb0ccab7 100644 --- a/src/wp-includes/html-api/class-wp-html-processor.php +++ b/src/wp-includes/html-api/class-wp-html-processor.php @@ -1292,6 +1292,7 @@ private function step_in_body() { $this->insert_html_element( $this->state->current_token ); $this->state->frameset_ok = false; $this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_TABLE; + return true; /* * > An end tag whose tag name is "br" @@ -1703,6 +1704,7 @@ private function step_in_table() { $this->insert_html_element( new WP_HTML_Token( null, 'TBODY', false ) ); + $this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_TABLE_BODY; return $this->step( self::REPROCESS_CURRENT_NODE ); /* @@ -1780,13 +1782,18 @@ private function step_in_table() { case "+FORM": if ( $this->state->stack_of_open_elements->has_element_in_scope( 'TEMPLATE' ) || - + $this->has_element_pointer( 'FORM' ) ) { + return $this->step(); } + $this->insert_html_element( $this->state->current_token ); + $this->set_element_pointer( 'FORM' ); + return true; /* * > An end-of-file token */ + /* * > Anything else * > Parse error. Enable foster parenting, process the token using the rules for the @@ -2391,6 +2398,14 @@ public function has_bookmark( $bookmark_name ) { return parent::has_bookmark( "_{$bookmark_name}" ); } + private function set_element_pointer( string $tag_name ) { + return parent::set_bookmark( "element_pointer_{$tag_name}" ); + } + + private function has_element_pointer( string $tag_name ) { + return parent::has_bookmark( "element_pointer_{$tag_name}" ); + } + /* * HTML Parsing Algorithms */