-
Notifications
You must be signed in to change notification settings - Fork 219
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
Webkit fails to render SVGs #39
Comments
Thanks for reporting. As far as I can tell, this is an issue with Webkit. It works fine in Firefox. Please see this test case: http://jsfiddle.net/cburgmer/c7EcP/4/. Green borders show an It seems that Chrome and Safari in the newest versions don't render an SVG inside another SVG's The third column in this test case indicates a possible workaround for Webkit. Here the internal SVG is converted to an I don't think I will get to implementing such a workaround in the near future. Anybody willing to do so can have a look how external image references are embedded as an example. |
Of course, if you have a say over the content you can work around that bug yourself. Just replace the SVG with the following image:
This can have side effects with CSS applied to the SVG. |
is there a way to keep the CSS styles while using the workaround? |
If you follow the general idea above, then CSS embedded in the SVG (not linked) should automatically apply. My thoughts were more around styles applied from the parent document - however it seems that they don't apply across borders anyway. In case there's still an issue please provide an example on jsfiddle (or similar) and we can have a look at it. |
the styles were not embedded and that is why I had a problem. I stripped them by hand from the stylesheet and added them to the svg. It works now. Thanks for the solution! |
Chrome in the mean time seems to work well with the test case I've posted above. Safari still fails. |
It looks like this is working in Safari now. |
Thanks, Simon. It also works for me now. Seems WebKit has caught up! I've updated the docs (https://github.com/cburgmer/rasterizeHTML.js/wiki/Limitations#webkit-origin), and will close the issue. As always, happy to reopen if necessary. |
Including SVGs in the HTML leads to a parsing error. Is it possible to add SVG support?
Example SVG:
The text was updated successfully, but these errors were encountered: