Skip to content

Commit bae79dd

Browse files
authored
fix(compiler-core): fix v-on with modifiers on inline expression of undefined (#9866)
close #9865 improve isMemberExpression check for undefined
1 parent 24b1c1d commit bae79dd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ describe('isMemberExpression', () => {
122122
expect(fn(`123[a]`)).toBe(true)
123123
expect(fn(`foo() as string`)).toBe(false)
124124
expect(fn(`a + b as string`)).toBe(false)
125+
// #9865
126+
expect(fn('""')).toBe(false)
127+
expect(fn('undefined')).toBe(false)
128+
expect(fn('null')).toBe(false)
125129
})
126130
})
127131

packages/compiler-core/src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export const isMemberExpressionNode = __BROWSER__
163163
return (
164164
ret.type === 'MemberExpression' ||
165165
ret.type === 'OptionalMemberExpression' ||
166-
ret.type === 'Identifier'
166+
(ret.type === 'Identifier' && ret.name !== 'undefined')
167167
)
168168
} catch (e) {
169169
return false

0 commit comments

Comments
 (0)