Skip to content

Commit

Permalink
Merge pull request #134 from icorne/master
Browse files Browse the repository at this point in the history
#133: don't add empty classes
  • Loading branch information
czeckd authored Jul 28, 2021
2 parents 1790114 + b656f64 commit 7ebd761
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 7ebd761

Please sign in to comment.