Skip to content

Commit b439431

Browse files
bplaatawesomekling
authored andcommitted
LibWeb: Allow hr elements in select and optgroup elements
1 parent b8219e2 commit b439431

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3411,6 +3411,24 @@ void HTMLParser::handle_in_select(HTMLToken& token)
34113411
return;
34123412
}
34133413

3414+
// -> A start tag whose tag name is "hr"
3415+
if (token.is_start_tag() && token.tag_name() == HTML::TagNames::hr) {
3416+
// If the current node is an option element, pop that node from the stack of open elements.
3417+
if (current_node().local_name() == HTML::TagNames::option) {
3418+
(void)m_stack_of_open_elements.pop();
3419+
}
3420+
// If the current node is an optgroup element, pop that node from the stack of open elements.
3421+
if (current_node().local_name() == HTML::TagNames::optgroup) {
3422+
(void)m_stack_of_open_elements.pop();
3423+
}
3424+
// Insert an HTML element for the token. Immediately pop the current node off the stack of open elements.
3425+
(void)insert_html_element(token);
3426+
(void)m_stack_of_open_elements.pop();
3427+
// Acknowledge the token's self-closing flag, if it is set.
3428+
token.acknowledge_self_closing_flag_if_set();
3429+
return;
3430+
}
3431+
34143432
if (token.is_end_tag() && token.tag_name() == HTML::TagNames::optgroup) {
34153433
if (current_node().local_name() == HTML::TagNames::option && node_before_current_node().local_name() == HTML::TagNames::optgroup)
34163434
(void)m_stack_of_open_elements.pop();

0 commit comments

Comments
 (0)