File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
test/unit/specs/directives/public Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ Directive.prototype._bind = function () {
8888 if ( this . literal ) {
8989 this . update && this . update ( descriptor . raw )
9090 } else if (
91- this . expression &&
91+ ( this . expression || this . modifiers ) &&
9292 ( this . update || this . twoWay ) &&
9393 ! this . _checkStatement ( )
9494 ) {
Original file line number Diff line number Diff line change @@ -62,6 +62,12 @@ module.exports = {
6262 } ,
6363
6464 update : function ( handler ) {
65+ // stub a noop for v-on with no value,
66+ // e.g. @mousedown .prevent
67+ if ( ! this . descriptor . raw ) {
68+ handler = function ( ) { }
69+ }
70+
6571 if ( typeof handler !== 'function' ) {
6672 process . env . NODE_ENV !== 'production' && _ . warn (
6773 'v-on:' + this . arg + '="' +
Original file line number Diff line number Diff line change @@ -144,6 +144,16 @@ if (_.inBrowser) {
144144 expect ( prevented ) . toBe ( true )
145145 } )
146146
147+ it ( 'prevent modifier with no value' , function ( ) {
148+ new Vue ( {
149+ el : el ,
150+ template : '<a href="#123" @click.prevent>'
151+ } )
152+ var hash = window . location . hash
153+ trigger ( el . firstChild , 'click' )
154+ expect ( window . location . hash ) . toBe ( hash )
155+ } )
156+
147157 it ( 'multiple modifiers working together' , function ( ) {
148158 var outer = jasmine . createSpy ( 'outer' )
149159 var prevented
You can’t perform that action at this time.
0 commit comments