LibWeb: Split out "The end" from the HTML parsing spec to a function

Also add a spec link and some comments.
This commit is contained in:
Andreas Kling 2021-09-26 00:00:00 +02:00
parent f67648f872
commit e452550fda
Notes: sideshowbarker 2024-07-18 04:46:35 +09:00
2 changed files with 15 additions and 2 deletions

View file

@ -175,11 +175,22 @@ void HTMLParser::run(const AK::URL& url)
flush_character_insertions();
// "The end"
the_end();
}
// https://html.spec.whatwg.org/multipage/parsing.html#the-end
void HTMLParser::the_end()
{
// Once the user agent stops parsing the document, the user agent must run the following steps:
// FIXME: 1. If the active speculative HTML parser is not null, then stop the speculative HTML parser and return.
// FIXME: 2. Set the insertion point to undefined.
// 3. Update the current document readiness to "interactive".
m_document->set_ready_state("interactive");
// 3. Pop all the nodes off the stack of open elements.
// 4. Pop all the nodes off the stack of open elements.
while (!m_stack_of_open_elements.is_empty())
m_stack_of_open_elements.pop();