diff --git a/HTMLparser.c b/HTMLparser.c index f5fc5747..3c5e08ca 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -3649,6 +3649,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { int i; int discardtag = 0; + ctxt->endCheckState = 0; + SKIP(1); atts = ctxt->atts; @@ -3841,6 +3843,8 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) const xmlChar *oldname; int i; + ctxt->endCheckState = 0; + SKIP(2); if (CUR == '>') { @@ -4043,13 +4047,6 @@ htmlParseElementInternal(htmlParserCtxtPtr ctxt) { if (name == NULL) return(0); - /* - * Lookup the info for that element. - */ - info = htmlTagLookup(name); - if (info != NULL) - ctxt->endCheckState = info->dataMode; - if (ctxt->record_info) htmlNodeInfoPush(ctxt, &node_info); @@ -4071,6 +4068,11 @@ htmlParseElementInternal(htmlParserCtxtPtr ctxt) { return(0); SKIP(1); + /* + * Lookup the info for that element. + */ + info = htmlTagLookup(name); + /* * Check for an Empty Element from DTD definition */ @@ -4084,6 +4086,9 @@ htmlParseElementInternal(htmlParserCtxtPtr ctxt) { return(0); } + if (info != NULL) + ctxt->endCheckState = info->dataMode; + return(1); } @@ -4862,13 +4867,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (name == NULL) 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 */ @@ -4889,6 +4887,11 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { break; SKIP(1); + /* + * Lookup the info for that element. + */ + info = htmlTagLookup(name); + /* * Check for an Empty Element from DTD definition */ @@ -4902,6 +4905,9 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { htmlnamePop(ctxt); } + if (info != NULL) + ctxt->endCheckState = info->dataMode; + if (ctxt->record_info) htmlNodeInfoPush(ctxt, &node_info);