【问题标题】:Getting inkscape attribute with d3使用 d3 获取 inkscape 属性
【发布时间】:2013-06-14 03:06:20
【问题描述】:

我需要为使用 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.js inkscape


    【解决方案1】:

    试试这个:

    d3.select("#g123").node().getAttribute(":inkscape:label")
    

    阅读这篇文章了解原因:12

    【讨论】:

      猜你喜欢
      • 2017-09-24
      • 1970-01-01
      • 2012-05-05
      • 1970-01-01
      • 2016-11-04
      • 2012-10-26
      • 1970-01-01
      • 1970-01-01
      • 2019-10-24
      相关资源
      最近更新 更多