我的页面在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时,任何人都遇到了同样的问题