-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: add un-escape special symbols functionality #2426
Conversation
It seems to me that it is doing the opposite. With this function we will be able to display this three escaped characters: |
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.
I left my comment. Maybe it fixes this specific issue, but we should consider the broader context.
.replace(/&/g, '&') | ||
.replace(/</g, '<') | ||
.replace(/>/g, '>'); |
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.
Making an exception for some character just seems wrong. What about '
or "
? There are dozens of characters that could be unescaped.
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.
yeah, you're right.
.replace(/&/g, '&') | ||
.replace(/</g, '<') | ||
.replace(/>/g, '>'); |
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.
Additionally, what about numeric character references? According to the spec, it's also a valid text content. Example:<
can be represented as <
, >
as >
and &
as &
I guess we have to find another solution for that, that's why I closed that PR. |
Summary
Fixes #2411
Motivation: the parse function does not un-escape text from the SVG element. It prevents displaying special characters (such as <, >, &, and others) in SVG text elements.
Test Plan
The example is available in the test-examples app as Test2411
Compatibility