From 53e93e533a8de845a94259c7f6b92d6b23bc7050 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Thu, 3 Mar 2022 11:55:45 +0100 Subject: [PATCH] perf(material/icon): remove IE workaround Removes an IE-specific workaround that had some minor performance implications. --- src/material/icon/icon.spec.ts | 23 ----------------------- src/material/icon/icon.ts | 9 --------- 2 files changed, 32 deletions(-) diff --git a/src/material/icon/icon.spec.ts b/src/material/icon/icon.spec.ts index 7470ee040101..f6d97d8137a0 100644 --- a/src/material/icon/icon.spec.ts +++ b/src/material/icon/icon.spec.ts @@ -877,29 +877,6 @@ describe('MatIcon', () => { expect(svgElement.getAttribute('viewBox')).toBe('0 0 43 43'); }); - it('should add an extra string to the end of `style` tags inside SVG', fakeAsync(() => { - iconRegistry.addSvgIconLiteral( - 'fido', - trustHtml(` - - - - - `), - ); - - const fixture = TestBed.createComponent(IconFromSvgName); - fixture.componentInstance.iconName = 'fido'; - fixture.detectChanges(); - const styleTag = fixture.nativeElement.querySelector('mat-icon svg style'); - - // Note the extra whitespace at the end which is what we're testing for. This is a - // workaround for IE and Edge ignoring `style` tags in dynamically-created SVGs. - expect(styleTag.textContent).toBe('#woof {color: blue;} '); - - tick(); - })); - it('should prepend the current path to attributes with `url()` references', fakeAsync(() => { iconRegistry.addSvgIconLiteral( 'fido', diff --git a/src/material/icon/icon.ts b/src/material/icon/icon.ts index e65c4d7d6021..a7f6a1d8d733 100644 --- a/src/material/icon/icon.ts +++ b/src/material/icon/icon.ts @@ -321,15 +321,6 @@ export class MatIcon extends _MatIconBase implements OnInit, AfterViewChecked, C private _setSvgElement(svg: SVGElement) { this._clearSvgElement(); - // Workaround for IE11 and Edge ignoring `style` tags inside dynamically-created SVGs. - // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10898469/ - // Do this before inserting the element into the DOM, in order to avoid a style recalculation. - const styleTags = svg.querySelectorAll('style') as NodeListOf; - - for (let i = 0; i < styleTags.length; i++) { - styleTags[i].textContent += ' '; - } - // Note: we do this fix here, rather than the icon registry, because the // references have to point to the URL at the time that the icon was created. const path = this._location.getPathname();