我需要提取使用 Inkscape 创建的 SVG 文件中的组节点的 inkscape 标签属性:
SVG:
<g id="g123" inkscape:label="group 1">...</g>
代码:
d3.select("#g123").attr("inkscape:label"); // return null
注册 inkscape 命名空间也不起作用:
d3.ns.prefix.inkscape = "http://www.inkscape.org/namespaces/inkscape";
d3.select("#g123").attr("inkscape:label"); // return null
尽管这有效:
d3.select("#g123").node().getAttribute("inkscape:label")
我在这里做错了什么?
最佳答案
关于svg - 使用 d3 获取 inkscape 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17100480/