1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:28:13 +00:00

LibWeb: Allow hr elements in select and optgroup elements

This commit is contained in:
Bastiaan van der Plaat 2023-12-07 15:50:25 +01:00 committed by Andreas Kling
parent b8219e2cc4
commit b439431488

View file

@ -3411,6 +3411,24 @@ void HTMLParser::handle_in_select(HTMLToken& token)
return;
}
// -> A start tag whose tag name is "hr"
if (token.is_start_tag() && token.tag_name() == HTML::TagNames::hr) {
// If the current node is an option element, pop that node from the stack of open elements.
if (current_node().local_name() == HTML::TagNames::option) {
(void)m_stack_of_open_elements.pop();
}
// If the current node is an optgroup element, pop that node from the stack of open elements.
if (current_node().local_name() == HTML::TagNames::optgroup) {
(void)m_stack_of_open_elements.pop();
}
// Insert an HTML element for the token. Immediately pop the current node off the stack of open elements.
(void)insert_html_element(token);
(void)m_stack_of_open_elements.pop();
// Acknowledge the token's self-closing flag, if it is set.
token.acknowledge_self_closing_flag_if_set();
return;
}
if (token.is_end_tag() && token.tag_name() == HTML::TagNames::optgroup) {
if (current_node().local_name() == HTML::TagNames::option && node_before_current_node().local_name() == HTML::TagNames::optgroup)
(void)m_stack_of_open_elements.pop();