File tree 1 file changed +13
-6
lines changed 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -256,36 +256,43 @@ var utils = module.exports = {
256
256
} ,
257
257
258
258
/**
259
- * add class for IE9
259
+ * add class for IE
260
260
* uses classList if available
261
261
*/
262
262
addClass : function ( el , cls ) {
263
263
if ( el . classList ) {
264
264
el . classList . add ( cls )
265
265
} else {
266
- var cur = ' ' + el . className + ' '
266
+ var cur = ' ' + utils . getClassName ( el ) + ' '
267
267
if ( cur . indexOf ( ' ' + cls + ' ' ) < 0 ) {
268
- el . className = ( cur + cls ) . trim ( )
268
+ el . setAttribute ( 'class' , ( cur + cls ) . trim ( ) )
269
269
}
270
270
}
271
271
} ,
272
272
273
273
/**
274
- * remove class for IE9
274
+ * remove class for IE
275
275
*/
276
276
removeClass : function ( el , cls ) {
277
277
if ( el . classList ) {
278
278
el . classList . remove ( cls )
279
279
} else {
280
- var cur = ' ' + el . className + ' ' ,
280
+ var cur = ' ' + utils . getClassName ( el ) + ' ' ,
281
281
tar = ' ' + cls + ' '
282
282
while ( cur . indexOf ( tar ) >= 0 ) {
283
283
cur = cur . replace ( tar , ' ' )
284
284
}
285
- el . className = cur . trim ( )
285
+ el . setAttribute ( 'class' , cur . trim ( ) )
286
286
}
287
287
} ,
288
288
289
+ /**
290
+ * get class name for IE
291
+ */
292
+ getClassName : function ( el ) {
293
+ return ( el . className instanceof SVGAnimatedString ? el . className . baseVal : el . className )
294
+ } ,
295
+
289
296
/**
290
297
* Convert an object to Array
291
298
* used in v-repeat and array filters
You can’t perform that action at this time.
0 commit comments