File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 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 = {
221221 if ( hasClassList ) {
222222 el . classList . remove ( cls )
223223 } 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 ( )
227230 }
228231 }
229232}
Original file line number Diff line number Diff line change @@ -341,8 +341,10 @@ describe('UNIT: Utils', function () {
341341
342342 it ( 'should work' , function ( ) {
343343 var el = document . createElement ( 'div' )
344- el . className = 'hihi hi'
344+ el . className = 'hihi hi ha '
345345 utils . removeClass ( el , 'hi' )
346+ assert . strictEqual ( el . className , 'hihi ha' )
347+ utils . removeClass ( el , 'ha' )
346348 assert . strictEqual ( el . className , 'hihi' )
347349 } )
348350
You can’t perform that action at this time.
0 commit comments