srctree

Robin Linden parent 2126eba4 7d895df2
html2: Clarify parsing of <html> using InBody's rules

This will never change the insertion mode because it's always passed a<html> element and the handling of that never changes mode, but ingeneral, using the rules for a different insertion mode allows switchingthe current insertion mode.

inlinesplit
html2/parser_states.cpp added: 3, removed: 5, total 0
@@ -274,8 +274,7 @@ std::optional<InsertionMode> BeforeHead::process(IActions &a, html2::Token const
 
if (auto const *start = std::get_if<html2::StartTagToken>(&token)) {
if (start->tag_name == "html") {
InBody{}.process(a, token);
return {};
return InBody{}.process(a, token);
}
 
if (start->tag_name == "head") {
@@ -319,8 +318,7 @@ std::optional<InsertionMode> InHead::process(IActions &a, html2::Token const &to
if (auto const *start = std::get_if<html2::StartTagToken>(&token)) {
auto const &name = start->tag_name;
if (name == "html") {
InBody{}.process(a, token);
return {};
return InBody{}.process(a, token);
}
 
if (name == "base" || name == "basefont" || name == "bgsound" || name == "link") {