Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

added fix for removeSVGAttributes #108

Merged
merged 1 commit into from
Apr 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/src/demo/demo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Component, OnInit } from '@angular/core';
template: `
<div class="demo-svg1" aria-label="My icon 1" [inlineSVG]="'img/image.svg'" [onSVGLoaded]="handleSVG" [removeSVGAttributes]="['xmlns']"></div>
<div class="demo-svg2" aria-label="My icon 2" [inlineSVG]="'img/image.svg'" [replaceContents]="true" [setSVGAttributes]="_attrs">Content</div>
<div *ngIf="_showOther" class="demo-svg3" aria-label="My delayed icon" [inlineSVG]="'img/image_with_fill.svg'" [removeSVGAttributes]="['fill']"></div>
<div *ngIf="_showOther" class="demo-svg3" aria-label="My delayed icon" [inlineSVG]="'img/image_with_fill.svg'" [removeSVGAttributes]="['fill', 'width', 'height']"></div>
<div [inlineSVG]="'img/symbol.svg#fish'"></div>
<div [inlineSVG]="'#fish'"></div>
<div [inlineSVG]="'#fish'" [injectComponent]="true"></div>
Expand Down
1 change: 1 addition & 0 deletions src/svg-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function removeAttributes(element: Element, attrs: Array<string>): void {
for (let i = 0; i < svgAttrs.length; i++) {
if (attrs.indexOf(svgAttrs[i].name.toLowerCase()) > -1) {
element.removeAttribute(svgAttrs[i].name);
i--;
}
}

Expand Down