File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -105,8 +105,8 @@ export class MatSnackBarContainer extends BasePortalOutlet implements OnDestroy
105105 const element : HTMLElement = this . _elementRef . nativeElement ;
106106
107107 if ( this . snackBarConfig . panelClass || this . snackBarConfig . extraClasses ) {
108- element . classList . add ( ... this . _getCssClasses ( this . snackBarConfig . panelClass ) ,
109- ... this . _getCssClasses ( this . snackBarConfig . extraClasses ) ) ;
108+ this . _setCssClasses ( this . snackBarConfig . panelClass ) ;
109+ this . _setCssClasses ( this . snackBarConfig . extraClasses ) ;
110110 }
111111
112112 if ( this . snackBarConfig . horizontalPosition === 'center' ) {
@@ -176,15 +176,19 @@ export class MatSnackBarContainer extends BasePortalOutlet implements OnDestroy
176176 } ) ;
177177 }
178178
179- /** Convert the class list to a array of classes it can apply to the dom */
180- private _getCssClasses ( classList : undefined | string | string [ ] ) {
181- if ( classList ) {
182- if ( Array . isArray ( classList ) ) {
183- return classList ;
184- } else {
185- return [ classList ] ;
186- }
179+ /** Applies the user-specified list of CSS classes to the element. */
180+ private _setCssClasses ( classList : undefined | string | string [ ] ) {
181+ if ( ! classList ) {
182+ return ;
183+ }
184+
185+ const element = this . _elementRef . nativeElement ;
186+
187+ if ( Array . isArray ( classList ) ) {
188+ // Note that we can't use a spread here, because IE doesn't support multiple arguments.
189+ classList . forEach ( cssClass => element . classList . add ( cssClass ) ) ;
190+ } else {
191+ element . classList . add ( classList ) ;
187192 }
188- return [ ] ;
189193 }
190194}
You can’t perform that action at this time.
0 commit comments