为什么一个<image>标签被jQuery改变了<img>标签,在chrome中
我使用jQuery来控制chrome中的SVG文件,
$('svg #lotsofimage').append("<image xlink:href='" + conf[thing].base + "' width= '" + conf[thing].width + "px' height= '" + conf[thing].height + "px' x='" + thing_x + "pt' y='" + thing_y + "pt' ></image>");
但是我打开了开发工具,它显示如下:
<img xlink:href="xxxx" width="xxxx"> <image></image>was instead of <img />
如何处理?
这不是jQuery; 这是Chrome的DOM的实现。 尝试这个:
> document.createElement('image').tagName 'IMG'
Chrome,Firefox和Opera中,似乎只有Chrome浏览器才能做到这一点。 我在检查的几个标准中找不到任何这种行为的参考。 如果您希望Chrome创buildimage
标记,则可能需要使用document.createElementNS
将其明确地放在正确的名称空间中。 我不知道如何让jQuery来做到这一点。