Skip to content

fixing IE 11 crash on multiple selectMenu #1338

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

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/select-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ dc.selectMenu = function (parent, chartGroup) {
_chart._doRedraw();
return _chart;
};
// Fixing IE 11 crash when redrawing the chart
// see here for list of IE user Agents :
// http://www.useragentstring.com/pages/useragentstring.php?name=Internet+Explorer
var ua = window.navigator.userAgent;
// test for IE 11 but not a lower version (which contains MSIE in UA)
if (ua.indexOf('Trident/') > 0 && ua.indexOf('MSIE') === -1) {
_chart.redraw = _chart.render;
}

_chart._doRedraw = function () {
setAttributes();
Expand All @@ -63,7 +71,7 @@ dc.selectMenu = function (parent, chartGroup) {
if (_chart.hasFilter() && _multiple) {
_select.selectAll('option')
.property('selected', function (d) {
return d && _chart.filters().indexOf(String(_chart.keyAccessor()(d))) >= 0;
return typeof d !== 'undefined' && _chart.filters().indexOf(String(_chart.keyAccessor()(d))) >= 0;
});
} else if (_chart.hasFilter()) {
_select.property('value', _chart.filter());
Expand Down