我的网页正好在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);
};
}
我没有得到这里正在做什么。
在try块中即使使用setProperty方法,我们可以在调试器中看到d3_document.createElement(“div”)。style
它是抛出错误:
对象不支持属性或方法’setProperty’
在catch块中,它尝试访问窗口的CSSStyleDeclaration的原型,但这是未定义的。
任何人在使用d3.v3.js时出现同样的问题