mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 18:54:57 +00:00
LibHTML: Parse <element attribute=value> correctly
We were not committing the attribute at all in this case.
This commit is contained in:
parent
8946e50986
commit
c02f560f73
1 changed files with 15 additions and 13 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue