File tree 2 files changed +4
-3
lines changed 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ ClassList.prototype.toggle = function(name){
143
143
*/
144
144
145
145
ClassList . prototype . array = function ( ) {
146
- var arr = this . el . className . split ( re ) ;
146
+ var str = this . el . className . replace ( / ^ \s + | \s + $ / g, '' ) ;
147
+ var arr = str . split ( re ) ;
147
148
if ( '' === arr [ 0 ] ) arr . shift ( ) ;
148
149
return arr ;
149
150
} ;
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ describe('classes(el)', function(){
84
84
} )
85
85
86
86
it ( 'should ignore leading whitespace' , function ( ) {
87
- el . className = ' foo bar baz' ;
87
+ el . className = ' foo bar baz' ;
88
88
var ret = classes ( el ) . array ( ) ;
89
89
assert ( 'foo' == ret [ 0 ] ) ;
90
90
assert ( 'bar' == ret [ 1 ] ) ;
@@ -93,7 +93,7 @@ describe('classes(el)', function(){
93
93
} )
94
94
95
95
it ( 'should ignore trailing whitespace' , function ( ) {
96
- el . className = 'foo bar baz ' ;
96
+ el . className = 'foo bar baz ' ;
97
97
var ret = classes ( el ) . array ( ) ;
98
98
assert ( 'foo' == ret [ 0 ] ) ;
99
99
assert ( 'bar' == ret [ 1 ] ) ;
You can’t perform that action at this time.
0 commit comments