-
Notifications
You must be signed in to change notification settings - Fork 22.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IE8 fix: filter __proto__ from for..in loops #2209
Conversation
Correction: calling |
I noticed that a lot more discussion about this has taken place in #2099, and that that issue was closed. I know that IE8 isn't exactly at the top of your list, but this is a pretty simple fix. I'd be happy to even refactor this a bit so that IE8 (using feature detection, of course) gets a different/slower version of the functions, so that this compatibility fix doesn't affect performance in modern browsers. |
+1 for this issue. Would also love a simple fix to avoid breaking at load time, I confirm this works on IE8:
|
FWIW, @sylvinus, aight now ships with an npm install -g aight
curl -s http://d3js.org/d3.v3.js | aight > d3.v3.ie8.js |
Not that it matters, but does IE8 log For 4.0, I am currently planning on ditching the So with apologies to Shawn (who I have neglected for months by not replying to this pull request), but I’m trying to minimize the amount of changes to 3.x and focus most of my effort getting 4.0 released. |
No worries, Mike! IE8 support is basically off my radar now that global and government site usage is <2%. I'm also going to use custom 4.0 bundles from now on to save precious kb's, so 👍 |
👍 |
D3 is currently out of commission in IE8 thanks to some tight for..in loops in the
d3.map()
implementation. When d3.js is executed, IE8 fails while iterating overd3_svg_lineInterpolators
when it hits the__proto__
key:Because, unfortunately, in IE8:
Which means that we have to use
hasOwnProperty()
instead of just thein
operator. This PR suggests one fix (for which the tests pass, and I've confirmed it works in IE8), but it might have performance implications. For instance, instead of the locally boundhas(key)
these functions could callthis.has(key)
instead, which might be faster.I haven't looked too closely to see if there are any other places in d3 where this might apply, but the d3.map constructor might be a candidate.