diff options
author | Luke <luke.wilde@live.co.uk> | 2021-01-02 23:02:23 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-03 00:29:28 +0100 |
commit | 0bf44ac9d87714c0d6a7fea2a229e4b10bd791f7 (patch) | |
tree | 8fc0ce807192238a79d8df0cc34340fade6f8cba /Libraries | |
parent | 306aff80d03d25df185dee5a37b89d1af30daee4 (diff) | |
download | serenity-0bf44ac9d87714c0d6a7fea2a229e4b10bd791f7.zip |
LibWeb: Fully implement end tag parsing in foreign content
Required to view the Spotify home page
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp b/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp index 417effea75..bc95d4312a 100644 --- a/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp +++ b/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp @@ -2846,23 +2846,30 @@ void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken& } if (token.is_end_tag()) { - auto& node = current_node(); + RefPtr<DOM::Element> node = current_node(); // FIXME: Not sure if this is the correct to_lowercase, as the specification says "to ASCII lowercase" - if (node.tag_name().to_lowercase() != token.tag_name()) + if (node->tag_name().to_lowercase() != token.tag_name()) PARSE_ERROR(); - while (true) { - if (&node == &m_stack_of_open_elements.first()) { + for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) { + if (node == m_stack_of_open_elements.first()) { ASSERT(m_parsing_fragment); return; } // FIXME: See the above FIXME - if (node.tag_name().to_lowercase() == token.tag_name()) { - while (¤t_node() != &node) + if (node->tag_name().to_lowercase() == token.tag_name()) { + while (current_node() != node) m_stack_of_open_elements.pop(); m_stack_of_open_elements.pop(); return; } - TODO(); + + node = m_stack_of_open_elements.elements().at(i - 1); + + if (node->namespace_() != Namespace::HTML) + continue; + + process_using_the_rules_for(m_insertion_mode, token); + return; } } |