mirror of https://github.com/vuejs/core.git
fix(compiler-core): fix handling of delimiterOpen in VPre (#11915)
close #11913
This commit is contained in:
parent
d0b513eb46
commit
706d4ac1d0
|
@ -2019,6 +2019,21 @@ describe('compiler: parse', () => {
|
||||||
children: [{ type: NodeTypes.TEXT, content: `{{ number ` }],
|
children: [{ type: NodeTypes.TEXT, content: `{{ number ` }],
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const ast3 = baseParse(`<div v-pre><textarea>{{ foo </textarea></div>`, {
|
||||||
|
parseMode: 'html',
|
||||||
|
})
|
||||||
|
expect((ast3.children[0] as ElementNode).children).toMatchObject([
|
||||||
|
{
|
||||||
|
type: NodeTypes.ELEMENT,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
type: NodeTypes.TEXT,
|
||||||
|
content: `{{ foo `,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
test('self-closing v-pre', () => {
|
test('self-closing v-pre', () => {
|
||||||
|
|
|
@ -438,7 +438,7 @@ export default class Tokenizer {
|
||||||
// We have to parse entities in <title> and <textarea> tags.
|
// We have to parse entities in <title> and <textarea> tags.
|
||||||
if (!__BROWSER__ && c === CharCodes.Amp) {
|
if (!__BROWSER__ && c === CharCodes.Amp) {
|
||||||
this.startEntity()
|
this.startEntity()
|
||||||
} else if (c === this.delimiterOpen[0]) {
|
} else if (!this.inVPre && c === this.delimiterOpen[0]) {
|
||||||
// We also need to handle interpolation
|
// We also need to handle interpolation
|
||||||
this.state = State.InterpolationOpen
|
this.state = State.InterpolationOpen
|
||||||
this.delimiterIndex = 0
|
this.delimiterIndex = 0
|
||||||
|
|
Loading…
Reference in New Issue