1- import { warn } from '../../util/index'
1+ import { warn , setClass } from '../../util/index'
22import { BIND } from '../priorities'
33import vStyle from '../internal/style'
44
@@ -87,12 +87,13 @@ export default {
8787 handleObject : vStyle . handleObject ,
8888
8989 handleSingle ( attr , value ) {
90+ const el = this . el
9091 if (
9192 ! this . descriptor . interp &&
9293 attrWithPropsRE . test ( attr ) &&
93- attr in this . el
94+ attr in el
9495 ) {
95- this . el [ attr ] = attr === 'value'
96+ el [ attr ] = attr === 'value'
9697 ? value == null // IE9 will set input.value to "null" for null...
9798 ? ''
9899 : value
@@ -101,27 +102,34 @@ export default {
101102 // set model props
102103 var modelProp = modelProps [ attr ]
103104 if ( modelProp ) {
104- this . el [ modelProp ] = value
105+ el [ modelProp ] = value
105106 // update v-model if present
106- var model = this . el . __v_model
107+ var model = el . __v_model
107108 if ( model ) {
108109 model . listener ( )
109110 }
110111 }
111112 // 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 )
114115 return
115116 }
116117 // update attribute
117118 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 )
120128 } else {
121- this . el . setAttribute ( attr , value )
129+ el . setAttribute ( attr , value )
122130 }
123131 } else {
124- this . el . removeAttribute ( attr )
132+ el . removeAttribute ( attr )
125133 }
126134 }
127135}
0 commit comments