File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -221,9 +221,12 @@ var utils = module.exports = {
221
221
if ( hasClassList ) {
222
222
el . classList . remove ( cls )
223
223
} else {
224
- el . className = ( ' ' + el . className + ' ' )
225
- . replace ( ' ' + cls + ' ' , '' )
226
- . trim ( )
224
+ var cur = ' ' + el . className + ' ' ,
225
+ tar = ' ' + cls + ' '
226
+ while ( cur . indexOf ( tar ) >= 0 ) {
227
+ cur = cur . replace ( tar , ' ' )
228
+ }
229
+ el . className = cur . trim ( )
227
230
}
228
231
}
229
232
}
Original file line number Diff line number Diff line change @@ -341,8 +341,10 @@ describe('UNIT: Utils', function () {
341
341
342
342
it ( 'should work' , function ( ) {
343
343
var el = document . createElement ( 'div' )
344
- el . className = 'hihi hi'
344
+ el . className = 'hihi hi ha '
345
345
utils . removeClass ( el , 'hi' )
346
+ assert . strictEqual ( el . className , 'hihi ha' )
347
+ utils . removeClass ( el , 'ha' )
346
348
assert . strictEqual ( el . className , 'hihi' )
347
349
} )
348
350
You can’t perform that action at this time.
0 commit comments