mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibWeb: Handle an error condition for "a" start tag during "in body"
If we have an <a> element on the list of active formatting elements when hitting another "a" start tag, that's a parse error. Recover by using the AAA.
This commit is contained in:
parent
c8e0426ab9
commit
b9d5d45eff
Notes:
sideshowbarker
2024-07-19 05:57:46 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b9d5d45eff1
2 changed files with 8 additions and 2 deletions
|
@ -945,8 +945,13 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token)
|
|||
}
|
||||
|
||||
if (token.is_start_tag() && token.tag_name() == "a") {
|
||||
if (m_list_of_active_formatting_elements.last_element_with_tag_name_before_marker("a")) {
|
||||
TODO();
|
||||
if (auto* element = m_list_of_active_formatting_elements.last_element_with_tag_name_before_marker("a")) {
|
||||
PARSE_ERROR();
|
||||
run_the_adoption_agency_algorithm(token);
|
||||
m_list_of_active_formatting_elements.remove(*element);
|
||||
m_stack_of_open_elements.elements().remove_first_matching([&](auto& entry) {
|
||||
return entry.ptr() == element;
|
||||
});
|
||||
}
|
||||
reconstruct_the_active_formatting_elements();
|
||||
auto element = insert_html_element(token);
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
bool contains(const Element&) const;
|
||||
|
||||
const NonnullRefPtrVector<Element>& elements() const { return m_elements; }
|
||||
NonnullRefPtrVector<Element>& elements() { return m_elements; }
|
||||
|
||||
void pop_until_an_element_with_tag_name_has_been_popped(const FlyString&);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue