Browse Source

fix(parser): should reset inRCDATA state

pull/9708/head
Evan You 2 years ago
parent
commit
ef97e8b07d
  1. 6
      packages/compiler-core/__tests__/parse.spec.ts
  2. 1
      packages/compiler-core/src/tokenizer.ts

6
packages/compiler-core/__tests__/parse.spec.ts

@ -1952,6 +1952,12 @@ describe('compiler: parse', () => {
})
})
// edge case found in vue-macros where the input is TS or JSX
test('should reset inRCDATA state', () => {
baseParse(`<Foo>`, { parseMode: 'sfc', onError() {} })
expect(() => baseParse(`{ foo }`)).not.toThrow()
})
describe('decodeEntities option', () => {
test('use decode by default', () => {
const ast: any = baseParse('&gt;&lt;&amp;&apos;&quot;&foo;')

1
packages/compiler-core/src/tokenizer.ts

@ -271,6 +271,7 @@ export default class Tokenizer {
this.sectionStart = 0
this.index = 0
this.baseState = State.Text
this.inRCDATA = false
this.currentSequence = undefined!
this.newlines.length = 0
this.delimiterOpen = defaultDelimitersOpen

Loading…
Cancel
Save