所以我正在生成svg并且在svg中有< image>但是每当我附加< image>标签时标签,它被替换为< img>
$('body').prepend('
');
$('body').append('img tags: '+$('body').children('img').length+'
');
$('body').append('image tags: '+$('body').children('image').length);
那是怎么回事.
这是一个jQuery的东西吗?我在chrome和safari中尝试了相同的结果.
编辑:
结束使用此函数将svg代码附加到svg,其中第一个参数是svg的jQuery对象,第二个参数是要追加的svg代码.
function appendToSVG(svg,text){
text = svg.html()+text;
attributes = svg[0].attributes;
var attrs = '';
for (var i=0; i <= attributes.length-1; i++){
attrs += attributes[i].name+'="'+attributes[i].value+'" ';
}
svg.after(''+text+'');
svg.remove();
}