Skip to content

Commit e452550

Browse files
committed
LibWeb: Split out "The end" from the HTML parsing spec to a function
Also add a spec link and some comments.
1 parent f67648f commit e452550

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,22 @@ void HTMLParser::run(const AK::URL& url)
175175

176176
flush_character_insertions();
177177

178-
// "The end"
178+
the_end();
179+
}
180+
181+
// https://html.spec.whatwg.org/multipage/parsing.html#the-end
182+
void HTMLParser::the_end()
183+
{
184+
// Once the user agent stops parsing the document, the user agent must run the following steps:
185+
186+
// FIXME: 1. If the active speculative HTML parser is not null, then stop the speculative HTML parser and return.
187+
188+
// FIXME: 2. Set the insertion point to undefined.
179189

190+
// 3. Update the current document readiness to "interactive".
180191
m_document->set_ready_state("interactive");
181192

182-
// 3. Pop all the nodes off the stack of open elements.
193+
// 4. Pop all the nodes off the stack of open elements.
183194
while (!m_stack_of_open_elements.is_empty())
184195
m_stack_of_open_elements.pop();
185196

Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ class HTMLParser {
9494
void handle_after_frameset(HTMLToken&);
9595
void handle_after_after_frameset(HTMLToken&);
9696

97+
void the_end();
98+
9799
void stop_parsing() { m_stop_parsing = true; }
98100

99101
void generate_implied_end_tags(const FlyString& exception = {});

0 commit comments

Comments
 (0)