LibWeb/HTML: Combine duplicate parsing branches

These are combined in the current spec. No behaviour change.
This commit is contained in:
Sam Atkins 2025-11-25 14:44:07 +00:00 committed by Jelle Raaijmakers
parent 91e73ecde1
commit 6e2f8166f4
Notes: github-actions[bot] 2025-11-26 08:54:09 +00:00

View file

@ -2095,14 +2095,9 @@ void HTMLParser::handle_in_body(HTMLToken& token)
}
// -> A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "template", "title"
if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::base, HTML::TagNames::basefont, HTML::TagNames::bgsound, HTML::TagNames::link, HTML::TagNames::meta, HTML::TagNames::noframes, HTML::TagNames::script, HTML::TagNames::style, HTML::TagNames::template_, HTML::TagNames::title)) {
// Process the token using the rules for the "in head" insertion mode.
process_using_the_rules_for(InsertionMode::InHead, token);
return;
}
// -> An end tag whose tag name is "template"
if (token.is_end_tag() && token.tag_name() == HTML::TagNames::template_) {
if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::base, HTML::TagNames::basefont, HTML::TagNames::bgsound, HTML::TagNames::link, HTML::TagNames::meta, HTML::TagNames::noframes, HTML::TagNames::script, HTML::TagNames::style, HTML::TagNames::template_, HTML::TagNames::title))
|| (token.is_end_tag() && token.tag_name() == HTML::TagNames::template_)) {
// Process the token using the rules for the "in head" insertion mode.
process_using_the_rules_for(InsertionMode::InHead, token);
return;
@ -4373,13 +4368,10 @@ void HTMLParser::handle_in_template(HTMLToken& token)
}
// -> A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "template", "title"
if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::base, HTML::TagNames::basefont, HTML::TagNames::bgsound, HTML::TagNames::link, HTML::TagNames::meta, HTML::TagNames::noframes, HTML::TagNames::script, HTML::TagNames::style, HTML::TagNames::template_, HTML::TagNames::title)) {
process_using_the_rules_for(InsertionMode::InHead, token);
return;
}
// -> An end tag whose tag name is "template"
if (token.is_end_tag() && token.tag_name() == HTML::TagNames::template_) {
if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::base, HTML::TagNames::basefont, HTML::TagNames::bgsound, HTML::TagNames::link, HTML::TagNames::meta, HTML::TagNames::noframes, HTML::TagNames::script, HTML::TagNames::style, HTML::TagNames::template_, HTML::TagNames::title))
|| (token.is_end_tag() && token.tag_name() == HTML::TagNames::template_)) {
// Process the token using the rules for the "in head" insertion mode.
process_using_the_rules_for(InsertionMode::InHead, token);
return;
}