d3.js树形布局与IE的兼容性

时间:2016-03-07 11:59:17

标签: javascript jquery internet-explorer d3.js svg

与往常一样,Internet Explorer导致兼容性问题。这次是使用d3.js构建的树形图。我的树在其他浏览器中工作,但是当我在Internet Explorer 11中加载页面时出现以下错误:

SCRIPT5007: Unable to get property '0' of undefined or null reference

带有指向错误行的链接:

d3.select(this.parentNode.children[0]).attr('height', 21 * (lineNumber + 1));

我已经完成了对this question的每个回答以及尝试使用aight.js,但无济于事。我还尝试使用元标记<meta http-equiv="X-UA-Compatible" content="IE=Edge" />并更新了d3.min.js脚本。

IE中唯一加载的是一些非常破碎,被压扁,功能失调的svg外观。有任何想法吗?

更新

Here is a JSFiddle我的代码,以及我正在使用的jquery和d3的版本。

1 个答案:

答案 0 :(得分:0)

事实证明,Internet Explorer不喜欢$text = "3.2 Mark one answer You must NOT sound your horn between 10 pm and 6 am in a built-up area at any time in a built-up area between 11.30 pm and 7 am in a builtup area between 11.30 pm and 6 am on any road Vehicles can be noisy. Every effort must be made to prevent excessive noise, especially in built-up areas at night. Don’t"; preg_match_all("/^\h{1}.+?[\r\n]{1}(\H*?\b(?=[\r\n]{1}))?/im", $text, $matches); echo "<pre>"; var_dump($matches[0]); // the output: array(4) { [0]=> string(43) " between 10 pm and 6 am in a built-up area " [1]=> string(32) " at any time in a built-up area " [2]=> string(45) " between 11.30 pm and 7 am in a builtup area " [3]=> string(39) " between 11.30 pm and 6 am on any road " } 。 要让parentNode.children[0]的第一个孩子使用parentNode。这使脚本与IE兼容。

相关问题