diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-30 12:28:12 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-30 12:28:12 +0200 |
commit | 368044eabd2516d58257fb2e489c3618c513efa6 (patch) | |
tree | e9532e82870fd5d9afe3b2eeb8f540cbbeb955ca /Libraries/LibWeb | |
parent | e82226f3fb0cfcf7cb68f259a061c9b69549a7c0 (diff) | |
download | serenity-368044eabd2516d58257fb2e489c3618c513efa6.zip |
LibWeb: Flesh out the "in head" insertion mode and add missing cases
Diffstat (limited to 'Libraries/LibWeb')
-rw-r--r-- | Libraries/LibWeb/Parser/HTMLDocumentParser.cpp | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp b/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp index a985f846d1..cc2ad6301e 100644 --- a/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp +++ b/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp @@ -328,6 +328,13 @@ void HTMLDocumentParser::handle_in_head(HTMLToken& token) return; } + if (token.is_start_tag() && token.tag_name() == "meta") { + auto element = insert_html_element(token); + m_stack_of_open_elements.pop(); + token.acknowledge_self_closing_flag_if_set(); + return; + } + if (token.is_start_tag() && token.tag_name() == "title") { insert_html_element(token); m_tokenizer.switch_to({}, HTMLTokenizer::State::RCDATA); @@ -363,19 +370,32 @@ void HTMLDocumentParser::handle_in_head(HTMLToken& token) m_insertion_mode = InsertionMode::Text; return; } - - if (token.is_start_tag() && token.tag_name() == "meta") { - auto element = insert_html_element(token); - m_stack_of_open_elements.pop(); - token.acknowledge_self_closing_flag_if_set(); - return; - } if (token.is_end_tag() && token.tag_name() == "head") { m_stack_of_open_elements.pop(); m_insertion_mode = InsertionMode::AfterHead; return; } - TODO(); + + if (token.is_end_tag() && token.tag_name().is_one_of("body", "html", "br")) { + TODO(); + } + + if (token.is_start_tag() && token.tag_name() == "template") { + TODO(); + } + + if (token.is_end_tag() && token.tag_name() == "template") { + TODO(); + } + + if ((token.is_start_tag() && token.tag_name() == "head") || token.is_end_tag()) { + PARSE_ERROR(); + return; + } + + m_stack_of_open_elements.pop(); + m_insertion_mode = InsertionMode::AfterHead; + process_using_the_rules_for(m_insertion_mode, token); } void HTMLDocumentParser::handle_in_head_noscript(HTMLToken&) |