From a49890ee55025cb4a3097ad63a2fcd79459f2156 Mon Sep 17 00:00:00 2001 From: Geoff McLane Date: Fri, 24 Feb 2017 16:19:58 +0100 Subject: [PATCH] Issue #498 - parser.c - if a in a
just close. The previous action was to discard the second, while it is the second table that browsers will render. This conforms to the principle that the html output by tidy should render in a browser like the original html. --- src/parser.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/parser.c b/src/parser.c index 30a9911..6ff2388 100644 --- a/src/parser.c +++ b/src/parser.c @@ -3019,9 +3019,22 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m while ((node = TY_(GetToken)(doc, IgnoreWhitespace)) != NULL) { - if (node->tag == table->tag && node->type == EndTag) + if (node->tag == table->tag ) { - TY_(FreeNode)( doc, node); + if (node->type == EndTag) + { + TY_(FreeNode)(doc, node); + } + else + { + /* Issue #498 - If a
in a
+ * just close the current table, and issue a + * warning. The previous action was to discard + * this second
+ */ + TY_(UngetToken)(doc); + TY_(ReportError)(doc, table, node, TAG_NOT_ALLOWED_IN); + } lexer->istackbase = istackbase; table->closed = yes; #if !defined(NDEBUG) && defined(_MSC_VER)