xla*_*aok 4 javascript jquery svg google-chrome node.js
我使用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>");
Run Code Online (Sandbox Code Playgroud)
但我打开开发工具,它显示如下:
<img xlink:href="xxxx" width="xxxx">
<image></image>was instead of <img />
Run Code Online (Sandbox Code Playgroud)
怎么处理?
这不是jQuery; 这是Chrome的DOM实现.试试这个:
> document.createElement('image').tagName
'IMG'
Run Code Online (Sandbox Code Playgroud)
在Chrome,Firefox和Opera之外,似乎只有Chrome才能这样做.在我检查的几个标准中,我找不到任何对此行为的引用.如果您希望Chrome创建image标记,则可能需要使用明确的名称将其放在正确的命名空间中document.createElementNS.我不知道如何让jQuery这样做.
| 归档时间: |
|
| 查看次数: |
110 次 |
| 最近记录: |