diff --git a/Libraries/LibHTML/Parser/HTMLParser.cpp b/Libraries/LibHTML/Parser/HTMLParser.cpp index 6ae4895169..ef28a97cc2 100644 --- a/Libraries/LibHTML/Parser/HTMLParser.cpp +++ b/Libraries/LibHTML/Parser/HTMLParser.cpp @@ -281,6 +281,21 @@ static bool parse_html_document(const StringView& html, Document& document, Pare move_to_state(State::InAttributeList); break; } + move_to_state(State::InAttributeValueNoQuote); + [[fallthrough]]; + case State::InAttributeValueNoQuote: + if (isspace(ch)) { + commit_attribute(); + move_to_state(State::InAttributeList); + break; + } + if (ch == '>') { + commit_attribute(); + commit_tag(); + move_to_state(State::Free); + break; + } + attribute_value_buffer.append(ch); break; case State::InAttributeValueSingleQuote: if (ch == '\'') { @@ -298,19 +313,6 @@ static bool parse_html_document(const StringView& html, Document& document, Pare } attribute_value_buffer.append(ch); break; - case State::InAttributeValueNoQuote: - if (isspace(ch)) { - commit_attribute(); - move_to_state(State::InAttributeList); - break; - } - if (ch == '>') { - commit_tag(); - move_to_state(State::Free); - break; - } - attribute_value_buffer.append(ch); - break; default: fprintf(stderr, "Unhandled state %d\n", (int)state); ASSERT_NOT_REACHED();