Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Fix empty the end of the tag <form> #397

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -2616,7 +2616,6 @@ static bool handle_in_body(GumboParser* parser, GumboToken* token) {
;
return success;
} else {
bool result = true;
const GumboNode* node = state->_form_element;
assert(!node || node->type == GUMBO_NODE_ELEMENT);
state->_form_element = NULL;
Expand All @@ -2626,19 +2625,10 @@ static bool handle_in_body(GumboParser* parser, GumboToken* token) {
ignore_token(parser);
return false;
}
// This differs from implicitly_close_tags because we remove *only* the
// <form> element; other nodes are left in scope.
generate_implied_end_tags(parser, GUMBO_TAG_LAST);
if (get_current_node(parser) != node) {
parser_add_parse_error(parser, token);
result = false;
}

GumboVector* open_elements = &state->_open_elements;
int index = gumbo_vector_index_of(open_elements, node);
assert(index >= 0);
gumbo_vector_remove_at(parser, index, open_elements);
return result;
// Retrieve <form> element by using implicitly_close_tags rather than
// generate_implied_end_tags(parser, GUMBO_TAG_LAST);
return implicitly_close_tags(
parser, token, GUMBO_NAMESPACE_HTML, GUMBO_TAG_FORM);
}
} else if (tag_is(token, kEndTag, GUMBO_TAG_P)) {
if (!has_an_element_in_button_scope(parser, GUMBO_TAG_P)) {
Expand Down