1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

html: Allow attributes in end tags

Attribute are syntactically allowed in HTML5 end tags but otherwise
ignored.
This commit is contained in:
Nick Wellnhofer
2023-05-04 15:59:31 +02:00
parent f2272c231b
commit a80f8b64a9
5 changed files with 27 additions and 16 deletions

View File

@@ -3980,20 +3980,39 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt)
name = htmlParseHTMLName(ctxt, 0);
if (name == NULL)
return (0);
/*
* We should definitely be at the ending "S? '>'" part
* Parse and ignore attributes.
*/
SKIP_BLANKS;
if (CUR != '>') {
while ((CUR != 0) &&
(CUR != '>') &&
((CUR != '/') || (NXT(1) != '>')) &&
(ctxt->instate != XML_PARSER_EOF)) {
xmlChar *attvalue = NULL;
/* unexpected-solidus-in-tag */
if (CUR == '/') {
NEXT;
SKIP_BLANKS;
continue;
}
GROW;
htmlParseAttribute(ctxt, &attvalue);
if (attvalue != NULL)
xmlFree(attvalue);
SKIP_BLANKS;
}
if (CUR == '>') {
NEXT;
} else if ((CUR == '/') && (NXT(1) == '>')) {
SKIP(2);
} else {
htmlParseErr(ctxt, XML_ERR_GT_REQUIRED,
"End tag : expected '>'\n", NULL, NULL);
/* Skip to next '>' */
while ((PARSER_STOPPED(ctxt) == 0) &&
(CUR != 0) && (CUR != '>'))
NEXT;
}
if (CUR == '>')
NEXT;
/*
* if we ignored misplaced tags in htmlParseStartTag don't pop them