HTML API: Step past closing HTML, BODY tags

The HTML specification does not close HTML or BODY tags (pop them off the stack of open elements) when their tag closers are encountered. The HTML processor correctly handled this behavior, however it incorrectly "paused" by returning true from the step functions. 

Props jonsurrell, dmsnell, gziolo.
Fixes #62583.


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


git-svn-id: http://core.svn.wordpress.org/trunk@58886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
gziolo 2024-12-09 12:44:17 +00:00
parent 833417c545
commit e8b5d1a702
2 changed files with 25 additions and 4 deletions

View File

@ -2318,7 +2318,14 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
*/
$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_AFTER_BODY;
return true;
/*
* The BODY element is not removed from the stack of open elements.
* Only internal state has changed, this does not qualify as a "step"
* in terms of advancing through the document to another token.
* Nothing has been pushed or popped.
* Proceed to parse the next item.
*/
return $this->step();
/*
* > An end tag whose tag name is "html"
@ -4391,7 +4398,14 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
}
$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_AFTER_AFTER_BODY;
return true;
/*
* The HTML element is not removed from the stack of open elements.
* Only internal state has changed, this does not qualify as a "step"
* in terms of advancing through the document to another token.
* Nothing has been pushed or popped.
* Proceed to parse the next item.
*/
return $this->step();
}
/*
@ -4586,7 +4600,14 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
*/
case '-HTML':
$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_AFTER_AFTER_FRAMESET;
return true;
/*
* The HTML element is not removed from the stack of open elements.
* Only internal state has changed, this does not qualify as a "step"
* in terms of advancing through the document to another token.
* Nothing has been pushed or popped.
* Proceed to parse the next item.
*/
return $this->step();
/*
* > A start tag whose tag name is "noframes"

View File

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