Skip to content

Commit ec0ddd8

Browse files
authored
Merge pull request #3187 from plotly/custom-modebar-ie11-fix
Fix modebar <style> update in IE11
2 parents 0124828 + 935bd29 commit ec0ddd8

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

src/lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ lib.addRelatedStyleRule = function(uid, selector, styleString) {
713713
lib.deleteRelatedStyleRule = function(uid) {
714714
var id = 'plotly.js-style-' + uid,
715715
style = document.getElementById(id);
716-
if(style) style.remove();
716+
if(style) lib.removeElement(style);
717717
};
718718

719719
lib.isIE = function() {

test/jasmine/assets/unpolyfill.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Un-polyfills - to be included in karma.conf.js to catch
3+
* browser-dependent errors.
4+
*/
5+
6+
'use strict';
7+
8+
(function(arr) {
9+
arr.forEach(function(item) {
10+
Object.defineProperty(item, 'remove', {
11+
configurable: true,
12+
enumerable: true,
13+
writable: true,
14+
value: function remove() {
15+
throw Error([
16+
'test/jasmine/assets/unpolyfill.js error: calling ChildNode.remove()',
17+
'which is not available in IE.'
18+
].join(' '));
19+
}
20+
});
21+
});
22+
})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);

test/jasmine/karma.conf.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ var pathToStrictD3 = path.join(__dirname, '..', '..', 'tasks', 'util', 'strict_d
106106
var pathToJQuery = path.join(__dirname, 'assets', 'jquery-1.8.3.min.js');
107107
var pathToIE9mock = path.join(__dirname, 'assets', 'ie9_mock.js');
108108
var pathToCustomMatchers = path.join(__dirname, 'assets', 'custom_matchers.js');
109+
var pathToUnpolyfill = path.join(__dirname, 'assets', 'unpolyfill.js');
109110

110111
var reporters = (isFullSuite && !argv.tags) ? ['dots', 'spec'] : ['progress'];
111112
if(argv.failFast) reporters.push('fail-fast');
@@ -142,7 +143,7 @@ func.defaultConfig = {
142143
// list of files / patterns to load in the browser
143144
//
144145
// N.B. the rest of this field is filled below
145-
files: [pathToCustomMatchers],
146+
files: [pathToCustomMatchers, pathToUnpolyfill],
146147

147148
// list of files / pattern to exclude
148149
exclude: [],

0 commit comments

Comments
 (0)