diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-26 00:00:00 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-26 00:04:33 +0200 |
commit | e452550fda5b50762cbda84f9afc9d8fa331042b (patch) | |
tree | 249d971bbdfd37b9310756b61a5f32ea27899220 /Userland | |
parent | f67648f872c17c98d6b331503fe280d7a2a7fbb5 (diff) | |
download | serenity-e452550fda5b50762cbda84f9afc9d8fa331042b.zip |
LibWeb: Split out "The end" from the HTML parsing spec to a function
Also add a spec link and some comments.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp | 15 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index 007073aa57..dc00efe47d 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -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(); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h index 60f8553221..c30c374e7a 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h @@ -94,6 +94,8 @@ private: void handle_after_frameset(HTMLToken&); void handle_after_after_frameset(HTMLToken&); + void the_end(); + void stop_parsing() { m_stop_parsing = true; } void generate_implied_end_tags(const FlyString& exception = {}); |