1
- import { warn } from '../../util/index'
1
+ import { warn , setClass } from '../../util/index'
2
2
import { BIND } from '../priorities'
3
3
import vStyle from '../internal/style'
4
4
@@ -87,12 +87,13 @@ export default {
87
87
handleObject : vStyle . handleObject ,
88
88
89
89
handleSingle ( attr , value ) {
90
+ const el = this . el
90
91
if (
91
92
! this . descriptor . interp &&
92
93
attrWithPropsRE . test ( attr ) &&
93
- attr in this . el
94
+ attr in el
94
95
) {
95
- this . el [ attr ] = attr === 'value'
96
+ el [ attr ] = attr === 'value'
96
97
? value == null // IE9 will set input.value to "null" for null...
97
98
? ''
98
99
: value
@@ -101,27 +102,34 @@ export default {
101
102
// set model props
102
103
var modelProp = modelProps [ attr ]
103
104
if ( modelProp ) {
104
- this . el [ modelProp ] = value
105
+ el [ modelProp ] = value
105
106
// update v-model if present
106
- var model = this . el . __v_model
107
+ var model = el . __v_model
107
108
if ( model ) {
108
109
model . listener ( )
109
110
}
110
111
}
111
112
// do not set value attribute for textarea
112
- if ( attr === 'value' && this . el . tagName === 'TEXTAREA' ) {
113
- this . el . removeAttribute ( attr )
113
+ if ( attr === 'value' && el . tagName === 'TEXTAREA' ) {
114
+ el . removeAttribute ( attr )
114
115
return
115
116
}
116
117
// update attribute
117
118
if ( value != null && value !== false ) {
118
- if ( xlinkRE . test ( attr ) ) {
119
- this . el . setAttributeNS ( xlinkNS , attr , value )
119
+ if ( attr === 'class' ) {
120
+ // handle edge case #1960:
121
+ // class interpolation should not overwrite Vue transition class
122
+ if ( el . __v_trans ) {
123
+ value += ' ' + el . __v_trans . id + '-transition'
124
+ }
125
+ setClass ( el , value )
126
+ } else if ( xlinkRE . test ( attr ) ) {
127
+ el . setAttributeNS ( xlinkNS , attr , value )
120
128
} else {
121
- this . el . setAttribute ( attr , value )
129
+ el . setAttribute ( attr , value )
122
130
}
123
131
} else {
124
- this . el . removeAttribute ( attr )
132
+ el . removeAttribute ( attr )
125
133
}
126
134
}
127
135
}
0 commit comments