})
})
+ test('no expression (shorthand) in-DOM templates', () => {
+ try {
+ __BROWSER__ = true
+ // :id in in-DOM templates will be parsed into :id="" by browser
+ const node = parseWithVBind(`<div :id="" />`)
+ const props = (node.codegenNode as VNodeCall).props as ObjectExpression
+ expect(props.properties[0]).toMatchObject({
+ key: {
+ content: `id`,
+ isStatic: true,
+ },
+ value: {
+ content: `id`,
+ isStatic: false,
+ },
+ })
+ } finally {
+ __BROWSER__ = false
+ }
+ })
+
test('dynamic arg', () => {
const node = parseWithVBind(`<div v-bind:[id]="id"/>`)
const props = (node.codegenNode as VNodeCall).props as CallExpression
`[@vue/compiler-core] decodeEntities option is passed but will be ` +
`ignored in non-browser builds.`,
)
- } else if (__BROWSER__ && !currentOptions.decodeEntities) {
+ } else if (__BROWSER__ && !__TEST__ && !currentOptions.decodeEntities) {
throw new Error(
`[@vue/compiler-core] decodeEntities option is required in browser builds.`,
)
if (
prop.type === NodeTypes.DIRECTIVE &&
prop.name === 'bind' &&
- !prop.exp
+ (!prop.exp ||
+ // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
+ (__BROWSER__ &&
+ prop.exp.type === NodeTypes.SIMPLE_EXPRESSION &&
+ !prop.exp.content.trim()))
) {
const arg = prop.arg!
if (arg.type !== NodeTypes.SIMPLE_EXPRESSION || !arg.isStatic) {