警告改变d3.js中对象的[[prototype]]?

时间:2015-02-23 14:36:52

标签: javascript firefox d3.js

我正在使用d3.js进行数据可视化。我收到了下图中显示的警告。enter image description here有没有人知道为什么会发生这种情况,我该如何解决这个问题?错误中显示的消息如下

mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

1 个答案:

答案 0 :(得分:8)

  

有没有人知道为什么会发生这种情况

看起来好像是他的错。他们似乎使用它来子类化数组here

// Until ECMAScript supports array subclassing, prototype injection works well.
var d3_subclass = function(object, prototype) {
  object.__proto__ = prototype;
};
  

我该如何解决这个问题?

忽略警告。或提交的错误,查看d3.js的this issue

相关问题