Skip to content

Fix modebar <style> update in IE11 #3187

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

Merged
merged 2 commits into from
Oct 30, 2018
Merged
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
2 changes: 1 addition & 1 deletion src/lib/index.js
Original file line number Diff line number Diff line change
@@ -713,7 +713,7 @@ lib.addRelatedStyleRule = function(uid, selector, styleString) {
lib.deleteRelatedStyleRule = function(uid) {
var id = 'plotly.js-style-' + uid,
style = document.getElementById(id);
if(style) style.remove();
if(style) lib.removeElement(style);
};

lib.isIE = function() {
22 changes: 22 additions & 0 deletions test/jasmine/assets/unpolyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Un-polyfills - to be included in karma.conf.js to catch
* browser-dependent errors.
*/

'use strict';

(function(arr) {
arr.forEach(function(item) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken from @alexcjohnson 's #3186 (comment), this gave

image

before the previous commit.

I chose to throw instead of logging to avoid situations like the one solved in #3168.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: we could also add unpolyfill.js to our image tests (like we do for strict-d3).

I chose not to as throwing errors in our jasmine test should be enough to catch these bugs and debugging the old nw.js image server is a pain.

Object.defineProperty(item, 'remove', {
configurable: true,
enumerable: true,
writable: true,
value: function remove() {
throw Error([
'test/jasmine/assets/unpolyfill.js error: calling ChildNode.remove()',
'which is not available in IE.'
].join(' '));
}
});
});
})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);
3 changes: 2 additions & 1 deletion test/jasmine/karma.conf.js
Original file line number Diff line number Diff line change
@@ -106,6 +106,7 @@ var pathToStrictD3 = path.join(__dirname, '..', '..', 'tasks', 'util', 'strict_d
var pathToJQuery = path.join(__dirname, 'assets', 'jquery-1.8.3.min.js');
var pathToIE9mock = path.join(__dirname, 'assets', 'ie9_mock.js');
var pathToCustomMatchers = path.join(__dirname, 'assets', 'custom_matchers.js');
var pathToUnpolyfill = path.join(__dirname, 'assets', 'unpolyfill.js');

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

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