Skip to content

Commit ef97e8b

Browse files
committed
fix(parser): should reset inRCDATA state
1 parent 7d89887 commit ef97e8b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -1952,6 +1952,12 @@ describe('compiler: parse', () => {
19521952
})
19531953
})
19541954

1955+
// edge case found in vue-macros where the input is TS or JSX
1956+
test('should reset inRCDATA state', () => {
1957+
baseParse(`<Foo>`, { parseMode: 'sfc', onError() {} })
1958+
expect(() => baseParse(`{ foo }`)).not.toThrow()
1959+
})
1960+
19551961
describe('decodeEntities option', () => {
19561962
test('use decode by default', () => {
19571963
const ast: any = baseParse('&gt;&lt;&amp;&apos;&quot;&foo;')

packages/compiler-core/src/tokenizer.ts

+1
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ export default class Tokenizer {
271271
this.sectionStart = 0
272272
this.index = 0
273273
this.baseState = State.Text
274+
this.inRCDATA = false
274275
this.currentSequence = undefined!
275276
this.newlines.length = 0
276277
this.delimiterOpen = defaultDelimitersOpen

0 commit comments

Comments
 (0)