SVG foreignObject是否仅适用于静态HTML?

时间:2016-02-24 20:40:20

标签: d3.js svg

http://bl.ocks.org/mbostock/1424037所述,我看到foreignObject功能仅适用于静态输入的文本。如果我尝试这样的事情会发生什么:

'use strict';

module.exports = (req, res) => {

  if(req.file) {
  // here i want to do something with the file.
  }

};

foreignObject功能是否适用于函数返回的数据?

1 个答案:

答案 0 :(得分:0)

嗯,这确实有效。但是,需要注意的一件事是用.text替换.html。

node.append("foreignObject")
    .attr("class", "innerNode")
    .text(function (d) {
        return d.name; })