Skip to content
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

IE11: SVG embedded images are not processed #5756

Closed
TheDutchCoder opened this issue May 25, 2017 · 9 comments
Closed

IE11: SVG embedded images are not processed #5756

TheDutchCoder opened this issue May 25, 2017 · 9 comments

Comments

@TheDutchCoder
Copy link

Version

2.3.3

Reproduction link

https://jsfiddle.net/TheDutchCoder/z11fe07p/1964/

Steps to reproduce

Use v-html to output a valid SVG image string. IE11 will not handle this at all (the node will not appear)

What is expected?

The image node to appear in the DOM

What is actually happening?

No node appears in the DOM


In more complex cases, IE will issue the following errors:
[Vue warn]: Error in nextTick: "Error: Error parsing XML string"
XML5660: The specified prefix has not been declared. Line: 1, Column 249

Which seems to point at a missing xmlns:xlink="http://www.w3.org/1999/xlink", but even when that's added it has no effect.

@posva
Copy link
Member

posva commented May 25, 2017

For some reason, the innerHTML property doesn't exist (adding it does nothing either) in IE 11 in the g element, therefore v-html cannot do anything. I'm not sure we can do something for it, but I'll give it a deeper look

@TheDutchCoder
Copy link
Author

I'm not sure if that's the issue though, because all other stuff renders fine (other SVG Nodes for example), but you're probably in a better position to judge that ;)

I have an app that renders different SVG layers based on SVG strings and everything works fine, it really is just the <image> element that doesn't in IE11 (other SVG data works fine in IE11).

Hope that helps a bit.

@posva
Copy link
Member

posva commented May 25, 2017

Maybe it works for other things that are not g but at the moment v-html won't work on elements missing the innerHTML... I have no idea why IE 11 does that thought

@TheDutchCoder
Copy link
Author

TheDutchCoder commented May 25, 2017 via email

@yyx990803
Copy link
Member

https://jsfiddle.net/z11fe07p/1974/ <- this doesn't work in IE11 without Vue involved.

@TheDutchCoder
Copy link
Author

Hmm indeed, it seems my polyfill takes over and helps the v-html directive out to render the contents. I'll open an issue at their repo, as it seems the polyfill doesn't handle images properly then.

Thanks guys!

@ericcirone
Copy link

I'm running into this same issue. @TheDutchCoder did you ever get a workaround?

@Justineo
Copy link
Member

You should include svg-innerhtml to make v-html work with SVGs.

@ericcirone
Copy link

@Justineo That worked! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants