mirror of https://github.com/vuejs/core.git
fix(parser): directive arg should be undefined on shorthands with no arg
This commit is contained in:
parent
ebaeb2e0aa
commit
e49dffc9ec
|
@ -1941,6 +1941,17 @@ describe('compiler: parse', () => {
|
|||
})
|
||||
})
|
||||
|
||||
test('arg should be undefined on shorthand dirs with no arg', () => {
|
||||
const ast = baseParse(`<template #></template>`)
|
||||
const el = ast.children[0] as ElementNode
|
||||
expect(el.props[0]).toMatchObject({
|
||||
type: NodeTypes.DIRECTIVE,
|
||||
name: 'slot',
|
||||
exp: undefined,
|
||||
arg: undefined
|
||||
})
|
||||
})
|
||||
|
||||
describe('decodeEntities option', () => {
|
||||
test('use decode by default', () => {
|
||||
const ast: any = baseParse('><&'"&foo;')
|
||||
|
|
|
@ -238,6 +238,7 @@ const tokenizer = new Tokenizer(stack, {
|
|||
},
|
||||
|
||||
ondirarg(start, end) {
|
||||
if (start === end) return
|
||||
const arg = getSlice(start, end)
|
||||
if (inVPre) {
|
||||
;(currentProp as AttributeNode).name += arg
|
||||
|
|
Loading…
Reference in New Issue