Skip to content

Commit 6c7bc69

Browse files
committed
sfc parser: treat all custom blocks as special tags
1 parent 9e6255e commit 6c7bc69

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/compiler/parser/html-parser.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ const isSpecialTag = (tag, isSFC, stack) => {
5252
if (isScriptOrStyle(tag)) {
5353
return true
5454
}
55-
// top-level template that has a pre-processor
56-
if (
57-
isSFC &&
58-
tag === 'template' &&
59-
stack.length === 1 &&
60-
stack[0].attrs.some(hasLang)
61-
) {
62-
return true
55+
if (isSFC) {
56+
// top-level template that has no pre-processor
57+
if (tag === 'template' && stack.length === 1 && !stack[0].attrs.some(hasLang)) {
58+
return false
59+
} else {
60+
return true
61+
}
6362
}
6463
return false
6564
}

test/unit/modules/sfc/sfc-parser.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('Single File Component parser', () => {
7878
expect(res.template.content.trim()).toBe(`div\n h1(v-if='1 < 2') hello`)
7979
})
8080

81-
it('should handle custom blocks without without parsing them', () => {
81+
it('should handle custom blocks without parsing them', () => {
8282
const res = parseComponent(`
8383
<template>
8484
<div></div>

0 commit comments

Comments
 (0)