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

Method _updateFontIconClasses

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

Source from the content-addressed store, hash-verified

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