diff --git a/draftlogs/7251_change.md b/draftlogs/7251_change.md new file mode 100644 index 00000000000..0614e5d3360 --- /dev/null +++ b/draftlogs/7251_change.md @@ -0,0 +1 @@ + - Cleanup remaining code that was there to support the Internet Explorer [[#7251](https://github.com/plotly/plotly.js/pull/7251)] diff --git a/src/components/modebar/buttons.js b/src/components/modebar/buttons.js index 4ea6ccce589..82c5dff9a48 100644 --- a/src/components/modebar/buttons.js +++ b/src/components/modebar/buttons.js @@ -51,11 +51,6 @@ modeBarButtons.toImage = { Lib.notifier(_(gd, 'Taking snapshot - this may take a few seconds'), 'long'); - if(opts.format !== 'svg' && Lib.isIE()) { - Lib.notifier(_(gd, 'IE only supports svg. Changing format to svg.'), 'long'); - opts.format = 'svg'; - } - ['filename', 'width', 'height', 'scale'].forEach(function(key) { if(key in toImageButtonOptions) { opts[key] = toImageButtonOptions[key]; diff --git a/src/css/_base.scss b/src/css/_base.scss index f998d609fe5..de7b8bb4def 100644 --- a/src/css/_base.scss +++ b/src/css/_base.scss @@ -27,9 +27,6 @@ a { @include vendor('user-select', none); } -//Required for IE11. Other browsers set this by default. -svg { overflow: hidden; } - svg a { fill: $color-brand-primary; } svg a:hover { fill: #3c6dc5; } diff --git a/src/lib/index.js b/src/lib/index.js index c2b9b3f695f..a5942961ae2 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -755,10 +755,6 @@ lib.containsAny = function(s, fragments) { return false; }; -lib.isIE = function() { - return typeof window.navigator.msSaveBlob !== 'undefined'; -}; - var IS_SAFARI_REGEX = /Version\/[\d\.]+.*Safari/; lib.isSafari = function() { return IS_SAFARI_REGEX.test(window.navigator.userAgent); diff --git a/src/lib/search.js b/src/lib/search.js index c85ed5f975d..10e8a17ab61 100644 --- a/src/lib/search.js +++ b/src/lib/search.js @@ -64,7 +64,7 @@ exports.sorterDes = function(a, b) { return b - a; }; */ exports.distinctVals = function(valsIn) { var vals = valsIn.slice(); // otherwise we sort the original array... - vals.sort(exports.sorterAsc); // undefined listed in the end - also works on IE11 + vals.sort(exports.sorterAsc); // undefined listed in the end var last; for(last = vals.length - 1; last > -1; last--) { diff --git a/src/lib/supports_pixelated_image.js b/src/lib/supports_pixelated_image.js index 8abfe53940b..95b3d0feef4 100644 --- a/src/lib/supports_pixelated_image.js +++ b/src/lib/supports_pixelated_image.js @@ -19,7 +19,7 @@ function supportsPixelatedImage() { _supportsPixelated = false; // @see https://github.com/plotly/plotly.js/issues/6604 - var unsupportedBrowser = Lib.isIE() || Lib.isSafari() || Lib.isIOS(); + var unsupportedBrowser = Lib.isSafari() || Lib.isIOS(); if(window.navigator.userAgent && !unsupportedBrowser) { var declarations = Array.from(constants.CSS_DECLARATIONS).reverse(); diff --git a/src/plots/plots.js b/src/plots/plots.js index 9415c598ae8..6550eb353a8 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -146,7 +146,7 @@ plots.addLinks = function(gd) { // If text's width is bigger than the layout // Check that text is a child node or document.body - // because otherwise IE/Edge might throw an exception + // because otherwise Edge might throw an exception // when calling getComputedTextLength(). // Apparently offsetParent is null for invisibles. if(document.body.contains(text) && text.getComputedTextLength() >= (fullLayout.width - 20)) { diff --git a/src/snapshot/download.js b/src/snapshot/download.js index bf483c2b2bf..95c97fe7441 100644 --- a/src/snapshot/download.js +++ b/src/snapshot/download.js @@ -32,15 +32,6 @@ function downloadImage(gd, opts) { reject(new Error('Snapshotting already in progress.')); } - // see comments within svgtoimg for additional - // discussion of problems with IE - // can now draw to canvas, but CORS tainted canvas - // does not allow toDataURL - // svg format will work though - if(Lib.isIE() && opts.format !== 'svg') { - reject(new Error(helpers.MSG_IE_BAD_FORMAT)); - } - if(_gd) _gd._snapshotInProgress = true; var promise = toImage(gd, opts); diff --git a/src/snapshot/filesaver.js b/src/snapshot/filesaver.js index 180d30b9b39..bc7bab02052 100644 --- a/src/snapshot/filesaver.js +++ b/src/snapshot/filesaver.js @@ -23,16 +23,6 @@ function fileSaver(url, name, format) { var blob; var objectUrl; - // IE 10+ (native saveAs) - if(Lib.isIE()) { - // At this point we are only dealing with a decoded SVG as - // a data URL (since IE only supports SVG) - blob = helpers.createBlob(url, 'svg'); - window.navigator.msSaveBlob(blob, name); - blob = null; - return resolve(name); - } - if(canUseSaveLink) { blob = helpers.createBlob(url, format); objectUrl = helpers.createObjectURL(blob); diff --git a/src/snapshot/helpers.js b/src/snapshot/helpers.js index f5d9611b42a..3f50eb1a2d2 100644 --- a/src/snapshot/helpers.js +++ b/src/snapshot/helpers.js @@ -63,5 +63,3 @@ function fixBinary(b) { } exports.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; - -exports.MSG_IE_BAD_FORMAT = 'Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'; diff --git a/src/snapshot/svgtoimg.js b/src/snapshot/svgtoimg.js index ee8ad39e695..5a22360023a 100644 --- a/src/snapshot/svgtoimg.js +++ b/src/snapshot/svgtoimg.js @@ -13,19 +13,6 @@ function svgToImg(opts) { var svg = opts.svg; var format = opts.format || 'png'; - // IE only support svg - if(Lib.isIE() && format !== 'svg') { - var ieSvgError = new Error(helpers.MSG_IE_BAD_FORMAT); - reject(ieSvgError); - // eventually remove the ev - // in favor of promises - if(!opts.promise) { - return ev.emit('error', ieSvgError); - } else { - return promise; - } - } - var canvas = opts.canvas; var scale = opts.scale || 1; var w0 = opts.width || 300; diff --git a/src/snapshot/tosvg.js b/src/snapshot/tosvg.js index 1f39394b69e..75cd7086b98 100644 --- a/src/snapshot/tosvg.js +++ b/src/snapshot/tosvg.js @@ -143,11 +143,6 @@ module.exports = function toSVG(gd, format, scale) { .attr('stroke-width', 0); } - // fix for IE namespacing quirk? - // http://stackoverflow.com/questions/19610089/unwanted-namespaces-on-svg-markup-when-using-xmlserializer-in-javascript-with-ie - svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns', xmlnsNamespaces.svg); - svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); - if(format === 'svg' && scale) { svg.attr('width', scale * width); svg.attr('height', scale * height); @@ -161,26 +156,5 @@ 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 - // Even with this IE will not work due to tainted canvas - // see https://github.com/kangax/fabric.js/issues/1957 - // http://stackoverflow.com/questions/18112047/canvas-todataurl-working-in-all-browsers-except-ie10 - // Leave here just in case the CORS/tainted IE issue gets resolved - if(Lib.isIE()) { - // replace double quote with single quote - s = s.replace(/"/gi, '\''); - // url in svg are single quoted - // since we changed double to single - // we'll need to change these to double-quoted - s = s.replace(/(\('#)([^']*)('\))/gi, '(\"#$2\")'); - // font names with spaces will be escaped single-quoted - // we'll need to change these to double-quoted - s = s.replace(/(\\')/gi, '\"'); - } - return s; }; diff --git a/tasks/test_syntax.js b/tasks/test_syntax.js index 7fc13c3ab10..c9c0f1b78f9 100644 --- a/tasks/test_syntax.js +++ b/tasks/test_syntax.js @@ -90,7 +90,6 @@ function assertJasmineSuites() { /* * tests about the contents of source (and lib) files: - * - check that we don't have any features that break in IE * - check that we don't use getComputedStyle unexpectedly * - check that require statements use lowercase (to match assertFileNames) * or match the case of the source file @@ -98,15 +97,6 @@ function assertJasmineSuites() { function assertSrcContents() { var logs = []; - // These are forbidden in IE *only in SVG* but since - // that's 99% of what we do here, we'll forbid them entirely - // until there's some HTML use case where we need them. - // (not sure what we'd do then, but we'd think of something!) - var IE_SVG_BLACK_LIST = ['innerHTML', 'parentElement', 'children']; - - // Forbidden in IE in any context - var IE_BLACK_LIST = ['classList']; - // require'd built-in modules var BUILTINS = ['events']; @@ -122,28 +112,8 @@ function assertSrcContents() { // look for .classList if(node.type === 'MemberExpression') { var source = node.source(); - var parts = source.split('.'); - var lastPart = parts[parts.length - 1]; - - if(source === 'Math.sign') { - logs.push(file + ' : contains Math.sign (IE failure)'); - } else if(source === 'window.getComputedStyle') { + if(source === 'window.getComputedStyle') { getComputedStyleCnt++; - } else if(IE_BLACK_LIST.indexOf(lastPart) !== -1) { - logs.push(file + ' : contains .' + lastPart + ' (IE failure)'); - } else if(IE_SVG_BLACK_LIST.indexOf(lastPart) !== -1) { - // add special case for sunburst, icicle and treemap where we use 'children' - // off the d3-hierarchy output - var dirParts = path.dirname(file).split(path.sep); - var filename = dirParts[dirParts.length - 1]; - var isSunburstOrIcicleOrTreemap = - filename === 'sunburst' || - filename === 'icicle' || - filename === 'treemap'; - var isLinkedToObject = ['pt', 'd', 'parent', 'node'].indexOf(parts[parts.length - 2]) !== -1; - if(!(isSunburstOrIcicleOrTreemap && isLinkedToObject)) { - logs.push(file + ' : contains .' + lastPart + ' (IE failure in SVG)'); - } } } else if(node.type === 'Identifier' && node.source() === 'getComputedStyle') { if(node.parent.source() !== 'window.getComputedStyle') { diff --git a/test/jasmine/assets/unpolyfill.js b/test/jasmine/assets/unpolyfill.js deleted file mode 100644 index d90ec6ec98a..00000000000 --- a/test/jasmine/assets/unpolyfill.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Un-polyfills - to be included in karma.conf.js to catch - * browser-dependent errors. - */ - -'use strict'; - -(function(arr) { - arr.forEach(function(item) { - Object.defineProperty(item, 'remove', { - configurable: true, - enumerable: true, - writable: true, - value: function() { - throw Error([ - 'test/jasmine/assets/unpolyfill.js error: calling ChildNode.remove()', - 'which is not available in IE.' - ].join(' ')); - } - }); - - Object.defineProperty(item, 'prepend', { - configurable: true, - enumerable: true, - writable: true, - value: function() { - throw Error([ - 'test/jasmine/assets/unpolyfill.js error: calling ChildNode.prepend()', - 'which is not available in IE.' - ].join(' ')); - } - }); - }); -})([Element.prototype, CharacterData.prototype, DocumentType.prototype]); diff --git a/test/jasmine/karma.conf.js b/test/jasmine/karma.conf.js index e069438e5c9..eb350abccfe 100644 --- a/test/jasmine/karma.conf.js +++ b/test/jasmine/karma.conf.js @@ -118,7 +118,6 @@ if(isFullSuite) { } var pathToCustomMatchers = path.join(__dirname, 'assets', 'custom_matchers.js'); -var pathToUnpolyfill = path.join(__dirname, 'assets', 'unpolyfill.js'); var pathToSaneTopojsonDist = path.join(__dirname, '..', '..', 'node_modules', 'sane-topojson', 'dist'); var pathToMathJax2 = path.join(__dirname, '..', '..', 'node_modules', 'mathjax-v2'); var pathToMathJax3 = path.join(__dirname, '..', '..', 'node_modules', 'mathjax-v3'); @@ -189,7 +188,6 @@ func.defaultConfig = { // N.B. the rest of this field is filled below files: [ pathToCustomMatchers, - pathToUnpolyfill, // available to fetch from /base/node_modules/mathjax-v2/ // more info: http://karma-runner.github.io/3.0/config/files.html {pattern: pathToMathJax2 + '/**', included: false, watched: false, served: true}, diff --git a/test/jasmine/tests/download_test.js b/test/jasmine/tests/download_test.js index d245b9662a6..02466695809 100644 --- a/test/jasmine/tests/download_test.js +++ b/test/jasmine/tests/download_test.js @@ -86,54 +86,6 @@ describe('Plotly.downloadImage', function() { }) .then(done, done.fail); }, LONG_TIMEOUT_INTERVAL); - - it('should produce the right SVG output in IE', function(done) { - // mock up IE behavior - spyOn(Lib, 'isIE').and.callFake(function() { return true; }); - spyOn(slzProto, 'serializeToString').and.callFake(function() { - return serializeToString.apply(this, arguments) - .replace(/(\(#)([^")]*)(\))/gi, '(\"#$2\")'); - }); - var savedBlob; - window.navigator.msSaveBlob = function(blob) { savedBlob = blob; }; - - var expectedStart = 'not bold