Skip to content

Add info about last version supporting IE9 and IE10 and remove obsolete code #5373

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 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ where X.Y.Z is the semver of most recent plotly.js release.

## [1.49.5] -- 2019-09-18

### Changed
- Drop support for IE10 and IE9 as part of browserify upgrade [#4168]

### Fixed
- Clear rejected promises from queue when calling `Plotly.react` [#4197]
- Do not attempt to remove non-existing mapbox layout source and layers [#4197]
Expand Down
4 changes: 0 additions & 4 deletions devtools/test_dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
</div>
<div id="snapshot"></div>

<!-- uncomment below for IE9/10 support -->
<!-- <script>if(typeof window.Int16Array !== 'function')document.write("<scri"+"pt src='../../dist/extras/typedarray.min.js'></scr"+"ipt>");</script>
<script>document.write("<scri"+"pt src='../../dist/extras/request_animation_frame.js'></scr"+"ipt>");</script> -->

<script src="../../dist/extras/mathjax/MathJax.js?config=TeX-AMS-MML_SVG"></script>
<script id="source" src="../../build/plotly.js" charset="utf-8"></script>
<script src="../../build/test_dashboard-bundle.js" charset="utf-8"></script>
Expand Down
9 changes: 0 additions & 9 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ or the un-minified version as:
<script src="plotly.js" charset="utf-8"></script>
```

### To support IE9

*Before* the plotly.js script tag, add:

```html
<script>if(typeof window.Int16Array !== 'function')document.write("<scri"+"pt src='extras/typedarray.min.js'></scr"+"ipt>");</script>
<script>document.write("<scri"+"pt src='extras/request_animation_frame.js'></scr"+"ipt>");</script>
```

### To support MathJax

*Before* the plotly.js script tag, add:
Expand Down
11 changes: 2 additions & 9 deletions src/lib/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@

var isArray = Array.isArray;

// IE9 fallbacks

var ab = (typeof ArrayBuffer === 'undefined' || !ArrayBuffer.isView) ?
{isView: function() { return false; }} :
ArrayBuffer;

var dv = (typeof DataView === 'undefined') ?
function() {} :
DataView;
var ab = ArrayBuffer;
var dv = DataView;

function isTypedArray(a) {
return ab.isView(a) && !(a instanceof dv);
Expand Down
7 changes: 2 additions & 5 deletions src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,11 +712,6 @@ lib.isIE = function() {
return typeof window.navigator.msSaveBlob !== 'undefined';
};

var IS_IE9_OR_BELOW_REGEX = /MSIE [1-9]\./;
lib.isIE9orBelow = function() {
return lib.isIE() && IS_IE9_OR_BELOW_REGEX.test(window.navigator.userAgent);
};

var IS_SAFARI_REGEX = /Version\/[\d\.]+.*Safari/;
lib.isSafari = function() {
return IS_SAFARI_REGEX.test(window.navigator.userAgent);
Expand All @@ -727,6 +722,8 @@ lib.isIOS = function() {
return IS_IOS_REGEX.test(window.navigator.userAgent);
};

// Do we need this process now that IE9 and IE10 are not supported?
Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah, we could probably get rid of this now - and revert the change here that's its only consumer: 98adfae#diff-9c325f1fe845cf45c705407012f4d4d0be31a9d9fbead70d1f70c5dedde9c634

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 42c97e2.


/**
* Duck typing to recognize a d3 selection, mostly for IE9's benefit
* because it doesn't handle instanceof like modern browsers
Expand Down
23 changes: 3 additions & 20 deletions src/lib/loggers.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,10 @@ loggers.error = function() {
}
};

/*
* Robust apply, for IE9 where console.log doesn't support
* apply like other functions do
*/
function apply(f, args) {
if(f && f.apply) {
try {
// `this` should always be console, since here we're always
// applying a method of the console object.
f.apply(console, args);
return;
} catch(e) { /* in case apply failed, fall back on the code below */ }
}

// no apply - just try calling the function on each arg independently
for(var i = 0; i < args.length; i++) {
try {
f(args[i]);
} catch(e) {
// still fails - last resort simple console.log
console.log(args[i]);
}
// `this` should always be console, since here we're always
// applying a method of the console object.
f.apply(console, args);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could remove this function entirely now, just inline the apply calls. Also the console.trace fallback || console.log in log and warn could be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Done in bc2b0d1.

}
}
4 changes: 0 additions & 4 deletions src/snapshot/filesaver.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ function fileSaver(url, name, format) {
var blob;
var objectUrl;

if(Lib.isIE9orBelow()) {
reject(new Error('IE < 10 unsupported'));
}

// Safari doesn't allow downloading of blob urls
if(Lib.isSafari()) {
var prefix = format === 'svg' ? ',' : ';base64,';
Expand Down
2 changes: 1 addition & 1 deletion src/snapshot/svgtoimg.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function svgToImg(opts) {
var img = new Image();
var svgBlob, url;

if(format === 'svg' || Lib.isIE9orBelow() || Lib.isSafari()) {
if(format === 'svg' || Lib.isSafari()) {
url = helpers.encodeSVG(svg);
} else {
svgBlob = helpers.createBlob(svg, 'svg');
Expand Down
2 changes: 2 additions & 0 deletions src/snapshot/tosvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ module.exports = function toSVG(gd, format, scale) {
// Fix quotations around font strings and gradient URLs
s = s.replace(DUMMY_REGEX, '\'');

// Do we need this process now that IE9 and IE10 are not supported?

// IE is very strict, so we will need to clean
// svg with the following regex
// yes this is messy, but do not know a better way
Expand Down
9 changes: 0 additions & 9 deletions tasks/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ function getInfoContent() {
'<script src="plotly.js" charset="utf-8"></script>',
'```',
'',
'### To support IE9',
'',
'*Before* the plotly.js script tag, add:',
'',
'```html',
'<script>if(typeof window.Int16Array !== \'function\')document.write("<scri"+"pt src=\'extras/typedarray.min.js\'></scr"+"ipt>");</script>',
'<script>document.write("<scri"+"pt src=\'extras/request_animation_frame.js\'></scr"+"ipt>");</script>',
'```',
'',
'### To support MathJax',
'',
'*Before* the plotly.js script tag, add:',
Expand Down
3 changes: 3 additions & 0 deletions test/image/strict-d3.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* strict-d3: wrap selection.style to prohibit specific incorrect style values
* that are known to cause problems in IE (at least IE9)
*/

// Do we need this process now that IE9 and IE10 are not supported?
Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, if you look down below there's plenty here that applies to other browsers too. There may be some parts we could relax but no harm leaving it all for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. I removed the comment in 9276d08.


'use strict';

var d3 = require('@plotly/d3');
Expand Down
42 changes: 0 additions & 42 deletions test/jasmine/bundle_tests/ie9_test.js

This file was deleted.

11 changes: 0 additions & 11 deletions test/jasmine/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ if(argv.info) {
'Run all tests with the `noCI` tag on Firefox in a 1500px wide window:',
' $ npm run test-jasmine -- --tags=noCI --FF --width=1500',
'',
'Run the `ie9_test.js` bundle test with the verbose reporter:',
' $ npm run test-jasmine -- --bundleTest=ie9 --verbose',
'',
'Arguments:',
' - All non-flagged arguments corresponds to the test suites in `test/jasmine/tests/` to be run.',
' No need to add the `_test.js` suffix, we expand them correctly here.',
Expand Down Expand Up @@ -122,7 +119,6 @@ if(isFullSuite) {
var pathToShortcutPath = path.join(__dirname, '..', '..', 'tasks', 'util', 'shortcut_paths.js');
var pathToStrictD3 = path.join(__dirname, '..', '..', 'tasks', 'util', 'strict_d3.js');
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 pathToMathJax = path.join(constants.pathToDist, 'extras', 'mathjax');
Expand Down Expand Up @@ -323,13 +319,6 @@ if(isBundleTest) {
func.defaultConfig.files.push(constants.pathToPlotlyDistMin);
func.defaultConfig.preprocessors[testFileGlob] = ['browserify'];
break;
case 'ie9':
// load ie9_mock.js before plotly.js+test bundle
// to catch reference errors that could occur
// when plotly.js is first loaded.
func.defaultConfig.files.push(pathToIE9mock);
func.defaultConfig.preprocessors[testFileGlob] = ['browserify'];
break;
case 'plotschema':
func.defaultConfig.browserify.ignoreTransform = './tasks/compress_attributes.js';
func.defaultConfig.preprocessors[testFileGlob] = ['browserify'];
Expand Down
79 changes: 9 additions & 70 deletions test/jasmine/tests/lib_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1675,28 +1675,25 @@ describe('Test lib.js:', function() {
var stashLogLevel;
var stashOnGraphLogLevel;

function consoleFn(name, hasApply, messages) {
function consoleFn(name, messages) {
var out = function() {
if(hasApply) expect(this).toBe(window.console);
var args = [];
for(var i = 0; i < arguments.length; i++) args.push(arguments[i]);
messages.push([name, args]);
};

if(!hasApply) out.apply = undefined;

return out;
}

function mockConsole(hasApply, hasTrace, hasError) {
function mockConsole() {
var out = {
MESSAGES: []
};
out.log = consoleFn('log', hasApply, out.MESSAGES);
out.log = consoleFn('log', out.MESSAGES);

if(hasError) out.error = consoleFn('error', hasApply, out.MESSAGES);
out.error = consoleFn('error', out.MESSAGES);

if(hasTrace) out.trace = consoleFn('trace', hasApply, out.MESSAGES);
out.trace = consoleFn('trace', out.MESSAGES);

return out;
}
Expand All @@ -1713,8 +1710,8 @@ describe('Test lib.js:', function() {
config.notifyOnLogging = stashOnGraphLogLevel;
});

it('emits one console message if apply is available', function() {
var c = window.console = mockConsole(true, true, true);
it('emits one console message', function() {
var c = window.console = mockConsole();
config.logging = 2;

Lib.log('tick', 'tock', 'tick', 'tock', 1);
Expand All @@ -1728,50 +1725,8 @@ describe('Test lib.js:', function() {
]);
});

it('falls back on console.log if no trace', function() {
var c = window.console = mockConsole(true, false, true);
config.logging = 2;

Lib.log('Hi');
Lib.warn(42);

expect(c.MESSAGES).toEqual([
['log', ['LOG:', 'Hi']],
['log', ['WARN:', 42]]
]);
});

it('falls back on separate calls if no apply', function() {
var c = window.console = mockConsole(false, false, true);
config.logging = 2;

Lib.log('tick', 'tock', 'tick', 'tock', 1);
Lib.warn('I\'m', 'a', 'little', 'cuckoo', 'clock', [1, 2]);
Lib.error('cuckoo!', 'cuckoo!!!', {a: 1, b: 2});

expect(c.MESSAGES).toEqual([
['log', ['LOG:']],
['log', ['tick']],
['log', ['tock']],
['log', ['tick']],
['log', ['tock']],
['log', [1]],
['log', ['WARN:']],
['log', ['I\'m']],
['log', ['a']],
['log', ['little']],
['log', ['cuckoo']],
['log', ['clock']],
['log', [[1, 2]]],
['error', ['ERROR:']],
['error', ['cuckoo!']],
['error', ['cuckoo!!!']],
['error', [{a: 1, b: 2}]]
]);
});

it('omits .log at log level 1', function() {
var c = window.console = mockConsole(true, true, true);
var c = window.console = mockConsole();
config.logging = 1;

Lib.log(1);
Expand All @@ -1785,7 +1740,7 @@ describe('Test lib.js:', function() {
});

it('logs nothing at log level 0', function() {
var c = window.console = mockConsole(true, true, true);
var c = window.console = mockConsole();
config.logging = 0;

Lib.log(1);
Expand All @@ -1795,22 +1750,6 @@ describe('Test lib.js:', function() {
expect(c.MESSAGES).toEqual([]);
});

it('falls back on simple log if there is no console.error', function() {
// TODO

var c = window.console = mockConsole(true, true, false);
config.logging = 2;

Lib.error('who are you', 'who who... are you', {a: 1, b: 2});

expect(c.MESSAGES).toEqual([
['log', ['ERROR:']],
['log', ['who are you']],
['log', ['who who... are you']],
['log', [{a: 1, b: 2}]]
]);
});

describe('should log message in notifier div in accordance notifyOnLogging config option', function() {
var query = '.notifier-note';

Expand Down