MCPcopy Create free account
hub / github.com/angular/components / _updateFontIconClasses

Method _updateFontIconClasses

src/material/icon/icon.ts:359–387  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

357 }
358
359 private _updateFontIconClasses() {
360 if (!this._usingFontIcon()) {
361 return;
362 }
363
364 const elem: HTMLElement = this._elementRef.nativeElement;
365 const fontSetClasses = (
366 this.fontSet
367 ? this._iconRegistry.classNameForFontAlias(this.fontSet).split(/ +/)
368 : this._iconRegistry.getDefaultFontSetClass()
369 ).filter(className => className.length > 0);
370
371 this._previousFontSetClass.forEach(className => elem.classList.remove(className));
372 fontSetClasses.forEach(className => elem.classList.add(className));
373 this._previousFontSetClass = fontSetClasses;
374
375 if (
376 this.fontIcon !== this._previousFontIconClass &&
377 !fontSetClasses.includes('mat-ligature-font')
378 ) {
379 if (this._previousFontIconClass) {
380 elem.classList.remove(this._previousFontIconClass);
381 }
382 if (this.fontIcon) {
383 elem.classList.add(this.fontIcon);
384 }
385 this._previousFontIconClass = this.fontIcon;
386 }
387 }
388
389 /**
390 * Cleans up a value to be used as a fontIcon or fontSet.

Callers 3

fontSetMethod · 0.95
fontIconMethod · 0.95
ngOnInitMethod · 0.95

Calls 6

_usingFontIconMethod · 0.95
removeMethod · 0.65
filterMethod · 0.45
classNameForFontAliasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected