fix(v-on): properly detect member expressions with optional chaining
fix #4107
This commit is contained in:
parent
2937530bef
commit
963085d18c
@ -85,6 +85,7 @@ test('isMemberExpression', () => {
|
||||
expect(isMemberExpression('obj[1][2]')).toBe(true)
|
||||
expect(isMemberExpression('obj[1][2].foo[3].bar.baz')).toBe(true)
|
||||
expect(isMemberExpression(`a[b[c.d]][0]`)).toBe(true)
|
||||
expect(isMemberExpression('obj?.foo')).toBe(true)
|
||||
|
||||
// strings
|
||||
expect(isMemberExpression(`a['foo' + bar[baz]["qux"]]`)).toBe(true)
|
||||
@ -102,4 +103,5 @@ test('isMemberExpression', () => {
|
||||
expect(isMemberExpression('123[a]')).toBe(false)
|
||||
expect(isMemberExpression('a + b')).toBe(false)
|
||||
expect(isMemberExpression('foo()')).toBe(false)
|
||||
expect(isMemberExpression('a?b:c')).toBe(false)
|
||||
})
|
||||
|
@ -63,7 +63,7 @@ const enum MemberExpLexState {
|
||||
}
|
||||
|
||||
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/
|
||||
const validIdentCharRE = /[\.\w$\xA0-\uFFFF]/
|
||||
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/
|
||||
const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user