Skip to content

Commit ac00c5e

Browse files
jelbournandrewseguin
authored andcommitted
refactor(material/list): 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 f5dada0 commit ac00c5e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/material/core/line/line.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ export function setLines(lines: QueryList<unknown>, element: ElementRef<HTMLElem
5050

5151
/** Adds or removes a class from an element. */
5252
function setClass(element: ElementRef<HTMLElement>, className: string, isAdd: boolean): void {
53-
const classList = element.nativeElement.classList;
54-
isAdd ? classList.add(className) : classList.remove(className);
53+
element.nativeElement.classList.toggle(className, isAdd);
5554
}
5655

5756
@NgModule({

0 commit comments

Comments
 (0)