mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-04 21:17:55 +08:00
fix v-on handler with whitespaces (fix #3893)
This commit is contained in:
parent
8d2fc8e8ac
commit
74e4e11b44
@ -1,6 +1,6 @@
|
||||
/* @flow */
|
||||
|
||||
const simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/
|
||||
const simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*\s*$/
|
||||
|
||||
// keyCode aliases
|
||||
const keyCodes = {
|
||||
|
@ -244,6 +244,14 @@ describe('codegen', () => {
|
||||
)
|
||||
})
|
||||
|
||||
// #3893
|
||||
it('should not treat handler with unexpected whitespace as inline statement', () => {
|
||||
assertCodegen(
|
||||
'<input @input=" onInput ">',
|
||||
`with(this){return _h('input',{on:{"input": onInput }})}`
|
||||
)
|
||||
})
|
||||
|
||||
it('generate unhandled events', () => {
|
||||
assertCodegen(
|
||||
'<input @input="curent++">',
|
||||
|
Loading…
Reference in New Issue
Block a user