<!DOCTYPE html>
在上面。我在里面放了这样的东西:
<svg height="2em" width="3em" preserveAspectRatio="none" viewBox="0 0 100 100">
<rect x="0" y="0" width="100" height="100" fill="red"/>
</svg>
(没有名称空间,谢谢HTML5!),它在Chrome和FF4 beta中显示得非常好。
var box = new Element('svg', {'width':'3em', 'height':'2em', 'preserveAspectRatio': 'none', 'viewBox': '0 0 100 100'});
box.appendChild(new Element('rect', {fill:'red', x:'0', y:'0', width:'100', height:'100' }));
container.appendChild(box);
我可以在Firebug/DOM检查器(FF和Chrome)中看到,它正在为此创建相同的DOM结构。
HTML5SVG的功能是否仅限于静态HTML,我还需要通过JS添加SVG内容时使用名称空间,还是缺少了其他功能?