mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-31 05:39:55 +00:00
LibHTML: Parse <element attribute=value> correctly
We were not committing the attribute at all in this case.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user