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
It looks like this is a known issue and unlikely to get fixed.
https://groups.google.com/forum/?fromgroups=#!topic/d3-js/8lQ2BCR45BM
The work-around is to load d3 selectively - this works for me -
Had same problem which used to happen randomly, after some research i concluded that it's setting invalid css properties ( from IE point of view ) that caused it, in my case:
someSvg.append('svg:text') .text(function (d) { return d.label; }) .attr('text-anchor', 'left')
Where it should have been
So my advice would be to review all from-scritpt-stylings, or even better - move them to css completely. After such fix it should work like charm in IE9+
This can be fixed with a
DOCTYPE
:And a
meta
tag:Without those, IE will go into quirks mode and not understand what
CSSStyleDeclaration
is.