From e947d296e49f9e14a2e8af8212179411a79975e1 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Fri, 12 Feb 2016 20:49:14 +0800 Subject: [PATCH] Handle some issues with misusing VERS_HTML5 in the doctype. --- src/lexer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lexer.c b/src/lexer.c index c08b881..24b2343 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -1748,7 +1748,7 @@ Bool TY_(SetXHTMLDocType)( TidyDocImpl* doc ) TY_(RepairAttrValue)(doc, doctype, sys, ""); break; case TidyDoctypeAuto: - if (lexer->doctype == VERS_UNKNOWN) { + if (lexer->doctype == VERS_UNKNOWN || lexer->doctype == VERS_HTML5) { lexer->versionEmitted = XH50; return yes; } @@ -1828,7 +1828,8 @@ Bool TY_(FixDocType)( TidyDocImpl* doc ) if (doctype && (dtmode == TidyDoctypeAuto) && (lexer->doctype == VERS_HTML5) ) { - lexer->versionEmitted = lexer->doctype; + /* The version emitted cannot be a composite value! */ + lexer->versionEmitted = HT50; return yes; } if (dtmode == TidyDoctypeAuto &&