|
|
@@ -44,7 +44,23 @@ let IS_REGEX_CAPTURING_BROKEN = false
|
|
|
})
|
|
|
|
|
|
// Special Elements (can contain anything)
|
|
|
-const isSpecialTag = makeMap('script,style', true)
|
|
|
+const isScriptOrStyle = makeMap('script,style', true)
|
|
|
+const hasLang = attr => attr.name === 'lang' && attr.value !== 'html'
|
|
|
+const isSpecialTag = (tag, isSFC, stack) => {
|
|
|
+ if (isScriptOrStyle(tag)) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ // top-level template that has a pre-processor
|
|
|
+ if (
|
|
|
+ isSFC &&
|
|
|
+ tag === 'template' &&
|
|
|
+ stack.length === 1 &&
|
|
|
+ stack[0].attrs.some(hasLang)
|
|
|
+ ) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+}
|
|
|
|
|
|
const reCache = {}
|
|
|
|
|
|
@@ -74,7 +90,7 @@ export function parseHTML (html, options) {
|
|
|
while (html) {
|
|
|
last = html
|
|
|
// Make sure we're not in a script or style element
|
|
|
- if (!lastTag || !isSpecialTag(lastTag)) {
|
|
|
+ if (!lastTag || !isSpecialTag(lastTag, options.sfc, stack)) {
|
|
|
const textEnd = html.indexOf('<')
|
|
|
if (textEnd === 0) {
|
|
|
// Comment:
|