Skip to content

Commit d250b17

Browse files
authored
perf(material/icon): remove IE workaround (#24514)
Removes an IE-specific workaround that had some minor performance implications.
1 parent 764030d commit d250b17

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

src/material/icon/icon.spec.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -877,29 +877,6 @@ describe('MatIcon', () => {
877877
expect(svgElement.getAttribute('viewBox')).toBe('0 0 43 43');
878878
});
879879

880-
it('should add an extra string to the end of `style` tags inside SVG', fakeAsync(() => {
881-
iconRegistry.addSvgIconLiteral(
882-
'fido',
883-
trustHtml(`
884-
<svg>
885-
<style>#woof {color: blue;}</style>
886-
<path id="woof" name="woof"></path>
887-
</svg>
888-
`),
889-
);
890-
891-
const fixture = TestBed.createComponent(IconFromSvgName);
892-
fixture.componentInstance.iconName = 'fido';
893-
fixture.detectChanges();
894-
const styleTag = fixture.nativeElement.querySelector('mat-icon svg style');
895-
896-
// Note the extra whitespace at the end which is what we're testing for. This is a
897-
// workaround for IE and Edge ignoring `style` tags in dynamically-created SVGs.
898-
expect(styleTag.textContent).toBe('#woof {color: blue;} ');
899-
900-
tick();
901-
}));
902-
903880
it('should prepend the current path to attributes with `url()` references', fakeAsync(() => {
904881
iconRegistry.addSvgIconLiteral(
905882
'fido',

src/material/icon/icon.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,6 @@ export class MatIcon extends _MatIconBase implements OnInit, AfterViewChecked, C
321321
private _setSvgElement(svg: SVGElement) {
322322
this._clearSvgElement();
323323

324-
// Workaround for IE11 and Edge ignoring `style` tags inside dynamically-created SVGs.
325-
// See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10898469/
326-
// Do this before inserting the element into the DOM, in order to avoid a style recalculation.
327-
const styleTags = svg.querySelectorAll('style') as NodeListOf<HTMLStyleElement>;
328-
329-
for (let i = 0; i < styleTags.length; i++) {
330-
styleTags[i].textContent += ' ';
331-
}
332-
333324
// Note: we do this fix here, rather than the icon registry, because the
334325
// references have to point to the URL at the time that the icon was created.
335326
const path = this._location.getPathname();

0 commit comments

Comments
 (0)