Skip to content

MatIconRegistry cannot find icon with special id #15673

Closed
@bascoder

Description

@bascoder

What is the expected behavior?

The MatIconRegistry returns the correct icon using MatIconRegistry._extractSvgIconFromSet.

What is the current behavior?

MatIconRegistry._extractSvgIconFromSet cannot find the icon due to an incorrect query selector.

What are the steps to reproduce?

Register a SVG icon set containing a SVG with id "icon-300 my icon"

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular Material 5.1.0 and higher

Is there anything else we should know?

Currently the MatIconRegistry makes use of iconSet.querySelector('#' + iconName):
https://github.com/angular/material2/blob/master/src/lib/icon/icon-registry.ts#L452

Instead it should be using iconSet.getElementById(iconName)
Then in my case it returns the correct SVG element.

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions