IE9导入内联SVG< image>元素坏了 [英] IE9 importing inline SVG <image> elements broken

查看:77
本文介绍了IE9导入内联SVG< image>元素坏了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此方法将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 。这个 importNode的其他实现似乎处理你试过使用那个吗?

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&lt; image&gt;元素坏了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆