From 43a15c0d66656bef747b8a209c81bc0fc6838c1f Mon Sep 17 00:00:00 2001 From: erasermeng Date: Sun, 24 Dec 2017 18:55:44 +0800 Subject: [PATCH 1/2] fix(compiler): fix #7298: need escape '-' to prevent being parsed to comment tag --- src/compiler/parser/html-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/parser/html-parser.js b/src/compiler/parser/html-parser.js index 86955e0e7a..0090b5f654 100644 --- a/src/compiler/parser/html-parser.js +++ b/src/compiler/parser/html-parser.js @@ -22,7 +22,7 @@ const startTagOpen = new RegExp(`^<${qnameCapture}`) const startTagClose = /^\s*(\/?)>/ const endTag = new RegExp(`^<\\/${qnameCapture}[^>]*>`) const doctype = /^]+>/i -const comment = /^/g, '$1') + .replace(//g, '$1') // fix #7298: need escape '-' to prevent being parsed to comment tag in script tag .replace(//g, '$1') } if (shouldIgnoreFirstNewline(stackedTag, text)) { From 897f8eb6e0e44e881be5f64a9b0ef36004fee5fa Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 25 Dec 2017 10:49:27 -0500 Subject: [PATCH 2/2] tweak comments --- src/compiler/parser/html-parser.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/parser/html-parser.js b/src/compiler/parser/html-parser.js index 0090b5f654..e220361320 100644 --- a/src/compiler/parser/html-parser.js +++ b/src/compiler/parser/html-parser.js @@ -22,7 +22,8 @@ const startTagOpen = new RegExp(`^<${qnameCapture}`) const startTagClose = /^\s*(\/?)>/ const endTag = new RegExp(`^<\\/${qnameCapture}[^>]*>`) const doctype = /^]+>/i -const comment = /^/g, '$1') // fix #7298: need escape '-' to prevent being parsed to comment tag in script tag + .replace(//g, '$1') // #7298 .replace(//g, '$1') } if (shouldIgnoreFirstNewline(stackedTag, text)) {