File tree 1 file changed +4
-2
lines changed
src/platforms/web/runtime
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1
1
/* @flow */
2
2
3
+ const whitespaceRE = / \s + /
4
+
3
5
/**
4
6
* Add class with compatibility for SVG since classList is not supported on
5
7
* SVG elements in IE
@@ -13,7 +15,7 @@ export function addClass (el: HTMLElement, cls: ?string) {
13
15
/* istanbul ignore else */
14
16
if ( el . classList ) {
15
17
if ( cls . indexOf ( ' ' ) > - 1 ) {
16
- cls . split ( / \s + / ) . forEach ( c => el . classList . add ( c ) )
18
+ cls . split ( whitespaceRE ) . forEach ( c => el . classList . add ( c ) )
17
19
} else {
18
20
el . classList . add ( cls )
19
21
}
@@ -38,7 +40,7 @@ export function removeClass (el: HTMLElement, cls: ?string) {
38
40
/* istanbul ignore else */
39
41
if ( el . classList ) {
40
42
if ( cls . indexOf ( ' ' ) > - 1 ) {
41
- cls . split ( / \s + / ) . forEach ( c => el . classList . remove ( c ) )
43
+ cls . split ( whitespaceRE ) . forEach ( c => el . classList . remove ( c ) )
42
44
} else {
43
45
el . classList . remove ( cls )
44
46
}
You can’t perform that action at this time.
0 commit comments