Skip to content

Commit 706d4ac

Browse files
authored
fix(compiler-core): fix handling of delimiterOpen in VPre (#11915)
close #11913
1 parent d0b513e commit 706d4ac

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Diff for: packages/compiler-core/__tests__/parse.spec.ts

+15
Original file line numberDiff line numberDiff line change
@@ -2019,6 +2019,21 @@ describe('compiler: parse', () => {
20192019
children: [{ type: NodeTypes.TEXT, content: `{{ number ` }],
20202020
},
20212021
])
2022+
2023+
const ast3 = baseParse(`<div v-pre><textarea>{{ foo </textarea></div>`, {
2024+
parseMode: 'html',
2025+
})
2026+
expect((ast3.children[0] as ElementNode).children).toMatchObject([
2027+
{
2028+
type: NodeTypes.ELEMENT,
2029+
children: [
2030+
{
2031+
type: NodeTypes.TEXT,
2032+
content: `{{ foo `,
2033+
},
2034+
],
2035+
},
2036+
])
20222037
})
20232038

20242039
test('self-closing v-pre', () => {

Diff for: packages/compiler-core/src/tokenizer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ export default class Tokenizer {
438438
// We have to parse entities in <title> and <textarea> tags.
439439
if (!__BROWSER__ && c === CharCodes.Amp) {
440440
this.startEntity()
441-
} else if (c === this.delimiterOpen[0]) {
441+
} else if (!this.inVPre && c === this.delimiterOpen[0]) {
442442
// We also need to handle interpolation
443443
this.state = State.InterpolationOpen
444444
this.delimiterIndex = 0

0 commit comments

Comments
 (0)