Skip to content

Commit d897a0c

Browse files
jelbournandrewseguin
authored andcommitted
refactor(material/snack-bar): use classList.toggle
With Angular dropping IE11 support in version 13, we can now use `classList.toggle` with the second `force` param. Related to #7374
1 parent ac00c5e commit d897a0c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/material/snack-bar/snack-bar.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ export class MatSnackBar implements OnDestroy {
201201
this._breakpointObserver.observe(Breakpoints.HandsetPortrait).pipe(
202202
takeUntil(overlayRef.detachments())
203203
).subscribe(state => {
204-
const classList = overlayRef.overlayElement.classList;
205-
state.matches ? classList.add(this.handsetCssClass) : classList.remove(this.handsetCssClass);
204+
overlayRef.overlayElement.classList.toggle(this.handsetCssClass, state.matches);
206205
});
207206

208207
if (config.announcementMessage) {

0 commit comments

Comments
 (0)