srctree

Robin Linden parent a0f52685 ed1ac4d0
html2: Don't drop tags closed immediately after an attribute name

inlinesplit
html2/tokenizer.cpp added: 11, removed: 2, total 9
@@ -852,6 +852,7 @@ void Tokenizer::run() {
continue;
case '>':
state_ = State::Data;
emit(std::move(current_token_));
continue;
default:
start_attribute_in_current_tag_token({});
 
html2/tokenizer_test.cpp added: 11, removed: 2, total 9
@@ -516,5 +516,13 @@ int main() {
expect(tokens.empty());
});
 
etest::test("tag closed after attribute name", [] {
auto tokens = run_tokenizer("<one a><two b>");
expect_token(tokens, StartTagToken{.tag_name = "one", .attributes = {{"a", ""}}});
expect_token(tokens, StartTagToken{.tag_name = "two", .attributes = {{"b", ""}}});
expect_token(tokens, EndOfFileToken{});
expect(tokens.empty());
});
 
return etest::run_all_tests();
}