-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(icon): handle unescaped characters in names #15678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(icon): handle unescaped characters in names #15678
Conversation
src/lib/icon/icon-registry.ts
Outdated
@@ -449,7 +449,7 @@ export class MatIconRegistry implements OnDestroy { | |||
* returns it. Returns null if no matching element is found. | |||
*/ | |||
private _extractSvgIconFromSet(iconSet: SVGElement, iconName: string): SVGElement | null { | |||
const iconSource = iconSet.querySelector('#' + iconName); | |||
const iconSource = iconSet.querySelector(`[id="${iconName}"]`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment here like
// Use the `id="xxx"` syntax in order to escape special characters in the ID
// (versus using the #xxx syntax)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
1752fa4
to
8ec5964
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@crisbeto this passes presubmit, just needs a rebase |
Handles the icon registry not being able to find icons whose ids contain unescaped characters (e.g. spaces). Note that for this example in particular having a space in the id is invalid, however I did it since supporting it is trivial. Fixes angular#15673.
Rebased. |
8ec5964
to
8dfe10e
Compare
Rebased. |
Handles the icon registry not being able to find icons whose ids contain unescaped characters (e.g. spaces). Note that for this example in particular having a space in the id is invalid, however I did it since supporting it is trivial. Fixes angular#15673.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Handles the icon registry not being able to find icons whose ids contain unescaped characters (e.g. spaces).
Note that for this example in particular having a space in the id is invalid, however I did it since supporting it is trivial.
Fixes #15673.