1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

html: Make sure that character data mode is reset

This commit is contained in:
Nick Wellnhofer
2024-09-15 19:18:40 +02:00
parent c32397d51f
commit 24a6149fc4

View File

@ -3649,6 +3649,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
int i; int i;
int discardtag = 0; int discardtag = 0;
ctxt->endCheckState = 0;
SKIP(1); SKIP(1);
atts = ctxt->atts; atts = ctxt->atts;
@ -3841,6 +3843,8 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt)
const xmlChar *oldname; const xmlChar *oldname;
int i; int i;
ctxt->endCheckState = 0;
SKIP(2); SKIP(2);
if (CUR == '>') { if (CUR == '>') {
@ -4043,13 +4047,6 @@ htmlParseElementInternal(htmlParserCtxtPtr ctxt) {
if (name == NULL) if (name == NULL)
return(0); return(0);
/*
* Lookup the info for that element.
*/
info = htmlTagLookup(name);
if (info != NULL)
ctxt->endCheckState = info->dataMode;
if (ctxt->record_info) if (ctxt->record_info)
htmlNodeInfoPush(ctxt, &node_info); htmlNodeInfoPush(ctxt, &node_info);
@ -4071,6 +4068,11 @@ htmlParseElementInternal(htmlParserCtxtPtr ctxt) {
return(0); return(0);
SKIP(1); SKIP(1);
/*
* Lookup the info for that element.
*/
info = htmlTagLookup(name);
/* /*
* Check for an Empty Element from DTD definition * Check for an Empty Element from DTD definition
*/ */
@ -4084,6 +4086,9 @@ htmlParseElementInternal(htmlParserCtxtPtr ctxt) {
return(0); return(0);
} }
if (info != NULL)
ctxt->endCheckState = info->dataMode;
return(1); return(1);
} }
@ -4862,13 +4867,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if (name == NULL) if (name == NULL)
break; break;
/*
* Lookup the info for that element.
*/
info = htmlTagLookup(name);
if (info != NULL)
ctxt->endCheckState = info->dataMode;
/* /*
* Check for an Empty Element labeled the XML/SGML way * Check for an Empty Element labeled the XML/SGML way
*/ */
@ -4889,6 +4887,11 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
break; break;
SKIP(1); SKIP(1);
/*
* Lookup the info for that element.
*/
info = htmlTagLookup(name);
/* /*
* Check for an Empty Element from DTD definition * Check for an Empty Element from DTD definition
*/ */
@ -4902,6 +4905,9 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
htmlnamePop(ctxt); htmlnamePop(ctxt);
} }
if (info != NULL)
ctxt->endCheckState = info->dataMode;
if (ctxt->record_info) if (ctxt->record_info)
htmlNodeInfoPush(ctxt, &node_info); htmlNodeInfoPush(ctxt, &node_info);