File tree 2 files changed +13
-0
lines changed
test/unit/modules/compiler
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -528,6 +528,14 @@ function processAttrs (el) {
528
528
name = name . replace ( bindRE , '' )
529
529
value = parseFilters ( value )
530
530
isProp = false
531
+ if (
532
+ process . env . NODE_ENV !== 'production' &&
533
+ value . trim ( ) . length === 0
534
+ ) {
535
+ warn (
536
+ `The value for a v-bind expression cannot be empty. Found in "v-bind:${ name } "`
537
+ )
538
+ }
531
539
if ( modifiers ) {
532
540
if ( modifiers . prop ) {
533
541
isProp = true
Original file line number Diff line number Diff line change @@ -510,6 +510,11 @@ describe('parser', () => {
510
510
expect ( ast . props [ 0 ] . value ) . toBe ( 'msg' )
511
511
} )
512
512
513
+ it ( 'empty v-bind expression' , ( ) => {
514
+ parse ( '<div :empty-msg=""></div>' , baseOptions )
515
+ expect ( 'The value for a v-bind expression cannot be empty. Found in "empty-msg"' ) . toHaveBeenWarned ( )
516
+ } )
517
+
513
518
// #6887
514
519
it ( 'special case static attribute that must be props' , ( ) => {
515
520
const ast = parse ( '<video muted></video>' , baseOptions )
You can’t perform that action at this time.
0 commit comments