I am using this method to import an SVG doc into a page, and it works pretty well, but in IE9, none of the <image>
tags work after the import (they show up as broken images, even though their xlink:href
attribute is correct). Why does this happen, and is there any way around it? Here's a simple test page. It works fine in Chrome, FF, etc, but not in IE9.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
The js implementation of
importNode
provided in this answer doesn't properly set namespaced attributes, it should usesetAttributeNS
to setxlink:href
correctly. This other implementation of importNode seems to handle that, have you tried using that one instead?Apparently if I drop the
xlink:
and just usehref
, if fixes the problem in IE9, but breaks it in Chrome, etc. Weird! If anyone knows why, I'd be happy to accept your answer. See test 2.Adding
href
, in addition toxlink:href
fixes the issue everywhere.