Skip to content

Commit 798336f

Browse files
committed
chore: fix IE issues
1 parent 95198d1 commit 798336f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/lib/icon/icon-registry.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,10 @@ export class MdIconRegistry {
378378
private _toSvgElement(element: Element): SVGElement {
379379
let svg = this._svgElementFromString('<svg></svg>');
380380

381-
for (let i = 0; i < element.children.length; i++) {
382-
svg.appendChild(element.children[i].cloneNode(true));
381+
for (let i = 0; i < element.childNodes.length; i++) {
382+
if (element.childNodes[i].nodeType === Node.ELEMENT_NODE) {
383+
svg.appendChild(element.childNodes[i].cloneNode(true));
384+
}
383385
}
384386

385387
return svg;

src/lib/icon/icon.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function verifyPathChildElement(element: Element, attributeValue: string): void
3636
}
3737

3838

39-
describe('MdIcon', () => {
39+
fdescribe('MdIcon', () => {
4040

4141
beforeEach(async(() => {
4242
TestBed.configureTestingModule({
@@ -254,12 +254,12 @@ describe('MdIcon', () => {
254254
fixture.detectChanges();
255255

256256
const svgElement = verifyAndGetSingleSvgChild(mdIconElement);
257-
const firstChild = svgElement.children[0];
257+
const firstChild = svgElement.childNodes[0];
258258

259259
expect(svgElement.querySelector('symbol')).toBeFalsy();
260-
expect(svgElement.children.length).toBe(1);
260+
expect(svgElement.childNodes.length).toBe(1);
261261
expect(firstChild.nodeName.toLowerCase()).toBe('path');
262-
expect(firstChild.getAttribute('id')).toBe('quack');
262+
expect((firstChild as HTMLElement).getAttribute('id')).toBe('quack');
263263
});
264264

265265
it('should not wrap <svg> elements in icon sets in another svg tag', () => {

0 commit comments

Comments
 (0)