问题描述
我使用将SVG文档导入页面,它可以正常工作很好,但是在IE9中,导入后没有< image>
标签工作(它们显示为损坏的图像,即使它们的 xlink :href
属性是否正确)。为什么会发生这种情况,是否有任何解决办法?这是一个简单的。它适用于Chrome,FF等,但不适用于IE9。
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.
推荐答案
的js实现在中提供的importNode
未正确设置命名空间属性,应使用 setAttributeNS
正确设置 xlink:href
。这个似乎处理你试过使用那个吗?
The js implementation of importNode
provided in this answer doesn't properly set namespaced attributes, it should use setAttributeNS
to set xlink:href
correctly. This other implementation of importNode seems to handle that, have you tried using that one instead?
这篇关于IE9导入内联SVG< image>元素坏了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!