mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +03:00
html: Allow attributes in end tags
Attribute are syntactically allowed in HTML5 end tags but otherwise ignored.
This commit is contained in:
35
HTMLparser.c
35
HTMLparser.c
@@ -3980,20 +3980,39 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt)
|
|||||||
name = htmlParseHTMLName(ctxt, 0);
|
name = htmlParseHTMLName(ctxt, 0);
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We should definitely be at the ending "S? '>'" part
|
* Parse and ignore attributes.
|
||||||
*/
|
*/
|
||||||
SKIP_BLANKS;
|
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,
|
htmlParseErr(ctxt, XML_ERR_GT_REQUIRED,
|
||||||
"End tag : expected '>'\n", NULL, NULL);
|
"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
|
* if we ignored misplaced tags in htmlParseStartTag don't pop them
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ om/ad_static.asp?pid=2097&sid=1881&asid=7708"></a></IFRAME></CENTER></LI></FONT>
|
|||||||
./test/HTML/doc3.htm:795: HTML parser error : Unexpected end tag : iframe
|
./test/HTML/doc3.htm:795: HTML parser error : Unexpected end tag : iframe
|
||||||
document.write("42DF8478957377></IFRAME>");
|
document.write("42DF8478957377></IFRAME>");
|
||||||
^
|
^
|
||||||
./test/HTML/doc3.htm:804: HTML parser error : End tag : expected '>'
|
|
||||||
document.write("RIPT>");
|
|
||||||
^
|
|
||||||
./test/HTML/doc3.htm:804: HTML parser error : Unexpected end tag : sc");
|
./test/HTML/doc3.htm:804: HTML parser error : Unexpected end tag : sc");
|
||||||
document.write("RIPT>");
|
document.write("RIPT>");
|
||||||
^
|
^
|
||||||
|
|||||||
@@ -2696,7 +2696,6 @@ SAX.cdata(
|
|||||||
<!--
|
<!--
|
||||||
if ((, 532)
|
if ((, 532)
|
||||||
SAX.error: Unexpected end tag : iframe
|
SAX.error: Unexpected end tag : iframe
|
||||||
SAX.cdata(");
|
|
||||||
SAX.cdata(");
|
SAX.cdata(");
|
||||||
} else if ((parseI, 463)
|
} else if ((parseI, 463)
|
||||||
SAX.error: Unexpected end tag : sc");
|
SAX.error: Unexpected end tag : sc");
|
||||||
|
|||||||
@@ -217,9 +217,6 @@ wired.com&BANNER=Sprint" style="text-decoration:none"><font color="#000000">Spri
|
|||||||
./test/HTML/wired.html:408: HTML parser error : Opening and ending tag mismatch: a and font
|
./test/HTML/wired.html:408: HTML parser error : Opening and ending tag mismatch: a and font
|
||||||
com&BANNER=Sprint" style="text-decoration:none"><font color="#000000">Sprint</a>
|
com&BANNER=Sprint" style="text-decoration:none"><font color="#000000">Sprint</a>
|
||||||
^
|
^
|
||||||
./test/HTML/wired.html:408: HTML parser error : End tag : expected '>'
|
|
||||||
Sprint" style="text-decoration:none"><font color="#000000">Sprint</a></i></font<
|
|
||||||
^
|
|
||||||
./test/HTML/wired.html:408: HTML parser error : Unexpected end tag : font<
|
./test/HTML/wired.html:408: HTML parser error : Unexpected end tag : font<
|
||||||
" style="text-decoration:none"><font color="#000000">Sprint</a></i></font</font>
|
" style="text-decoration:none"><font color="#000000">Sprint</a></i></font</font>
|
||||||
^
|
^
|
||||||
|
|||||||
@@ -1960,7 +1960,6 @@ SAX.error: Opening and ending tag mismatch: a and font
|
|||||||
SAX.endElement(font)
|
SAX.endElement(font)
|
||||||
SAX.endElement(a)
|
SAX.endElement(a)
|
||||||
SAX.endElement(i)
|
SAX.endElement(i)
|
||||||
SAX.error: End tag : expected '>'
|
|
||||||
SAX.error: Unexpected end tag : font<
|
SAX.error: Unexpected end tag : font<
|
||||||
SAX.startElement(br)
|
SAX.startElement(br)
|
||||||
SAX.endElement(br)
|
SAX.endElement(br)
|
||||||
|
|||||||
Reference in New Issue
Block a user