From 4e0e8f20a3636e11f46350b9365e9d0b15a6e520 Mon Sep 17 00:00:00 2001 From: lizhouze Date: Fri, 22 Apr 2022 15:51:31 +0800 Subject: [PATCH] lizhouze@huawei.com Signed-off-by: lizhouze --- packages/parse5/lib/parser/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/parse5/lib/parser/index.js b/packages/parse5/lib/parser/index.js index 5eececd..0754484 100644 --- a/packages/parse5/lib/parser/index.js +++ b/packages/parse5/lib/parser/index.js @@ -941,12 +941,13 @@ function checkselfClosingNode(parse, token) { * Check if the html text is legal. * @param {Object} lastToken Hml text last token information. */ -function checkInvalid(lastToken) { +function checkInvalid(parse, lastToken) { if ( lastToken.type && lastToken.type !== Tokenizer.END_TAG_TOKEN && - lastToken.type !== Tokenizer.COMMENT_TOKEN + lastToken.type !== Tokenizer.COMMENT_TOKEN && parse && parse.compileResult && + parse.compileResult.log ) { - compileResult.log.push({ + parse.compileResult.log.push({ line: lastToken.location.startLine || 1, column: lastToken.location.startCol || 1, reason: "ERROR: hml content is invalid. Please check it.", -- Gitee