IE10 d3.v3.js错误:无法获取未定义或空引用的属性“原型” [英] IE10 d3.v3.js error: Unable to get property 'prototype' of undefined or null reference

查看:1540
本文介绍了IE10 d3.v3.js错误:无法获取未定义或空引用的属性“原型”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网页在IE9,Safari,Chrome和Chrome浏览器中完美载入。 Firefox。



但是当它转换到IE10时,它会抛出错误:
无法获取未定义或null引用的属性prototype >
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

解决方案

这可以使用 DOCTYPE



< <!DOCTYPE html>

meta 标记:

 < meta http-equiv =X-UA-Compatiblecontent =IE = edge/> 

没有这些,IE将进入怪异模式,不明白 CSSStyleDeclaration 是。


My page is loading perfectly in IE9, Safari, Chrome & Firefox.

But when it coems to IE10 , it throws error : Unable to get property 'prototype' of undefined or null reference in d3.v3.js at line : 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);
    };
  }

I am not getting what exactly is being done here.

In try block even though setProperty method we can see in debugger on d3_document.createElement("div").style it is throwing error as : Object doesn't support property or method 'setProperty'

In catch block it tries to access prototype of window's CSSStyleDeclaration , but that is undefined.

Anybody occured with same problem while using d3.v3.js

解决方案

This can be fixed with a DOCTYPE:

<!DOCTYPE html>

And a meta tag:

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

Without those, IE will go into quirks mode and not understand what CSSStyleDeclaration is.

这篇关于IE10 d3.v3.js错误:无法获取未定义或空引用的属性“原型”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆