-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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(SVGParser) ignore missing xlink target issue on svg parsing #9427
Fix(SVGParser) ignore missing xlink target issue on svg parsing #9427
Conversation
- Also remove elementById since it was needed for IE8 support
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.
This looks good
Thanks!
Can this happen with other directives like clip paths? Should we igonre them as well?
I didn't realize that was being used by the use tag (elements_parser apparently handles this). But I found an example and tested it. It worked normally and when I changed the id to a bad one, it ignored the clipping so looks like the code is already healthy for that. |
Could you add a test?
You are right, it is because of write access. |
Tacked on additional test. |
Do we have an svg with missing xlink and can we see how the browser renders it? |
i moved the read shape into the defs element so we can test that the use element with the wrong clip-path still work without the clippath. |
@ShaMan123 i m merging this since is a good fix and we can push it up with the beta right away, ok? |
sure |
Motivation
@closes #9109
Description
Sometimes an svg has use tags with an xlink with no target, which most parsers ignore. We should ignore these use tags as well.
Changes
Adds a null check and returns early, preventing an NPE.
Also removed elementById since it was needed for IE8 support, which we no longer support (see support for everything else here: https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById).
In Action