小编vaj*_*mar的帖子

IE10 d3.v3.js错误:无法获取未定义或空引用的属性"原型"

我的页面在IE9,Safari,Chrome和Firefox中完美加载.

但当它与IE10同步时,它会抛出错误: 无法d3.v3.js获取未定义或空引用的属性"原型":d3_window.CSSStyleDeclaration.prototype.

 try {
    d3_document.createElement("div").style.setProperty("opacity", 0, "");
  } catch (error) {
    var d3_style_prototype = d3_window.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
    d3_style_prototype.setProperty = function(name, value, priority) {
      d3_style_setProperty.call(this, name, value + "", priority);
    };
  }
Run Code Online (Sandbox Code Playgroud)

我不知道到底在做什么.

在try块中,即使setProperty方法,我们可以在调试器中看到d3_document.createElement("div").style 它抛出错误: 对象不支持属性或方法'setProperty'

在catch块中,它试图访问窗口的原型CSSStyleDeclaration,但这是未定义的.

使用d3.v3.js时,任何人都遇到了同样的问题

d3.js internet-explorer-10

19
推荐指数
1
解决办法
4万
查看次数

标签 统计

d3.js ×1

internet-explorer-10 ×1