Skip to content

Commit

Permalink
czeckd#133: don't add empty classes
Browse files Browse the repository at this point in the history
  • Loading branch information
icorne committed Jul 27, 2021
1 parent 1790114 commit b656f64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions projects/angular-svg-icon/src/lib/svg-icon.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@ export class SvgIconComponent implements OnInit, OnDestroy, OnChanges, DoCheck {
private setClass(target: HTMLElement|SVGSVGElement, previous: string|string[]|null, current: string|string[]|null) {
if (target) {
if (previous) {
const klasses = Array.isArray(previous) ? previous : previous.split(' ');
const klasses = (Array.isArray(previous) ? previous : previous.split(' ')).filter((klass) => klass);
for (const k of klasses) {
this.renderer.removeClass(target, k);
}
}
if (current) {
const klasses = Array.isArray(current) ? current : current.split(' ');
const klasses = (Array.isArray(current) ? current : current.split(' ')).filter((klass) => klass);
for (const k of klasses) {
this.renderer.addClass(target, k);
}
Expand Down

0 comments on commit b656f64

Please sign in to comment.