8000 remove Lib.isIE and cases · Coding-with-Adam/plotly.js@8de113b · GitHub
[go: up one dir, main page]

Skip to content

Commit 8de113b

Browse files
committed
remove Lib.isIE and cases
1 parent bd56393 commit 8de113b

File tree

7 files changed

+1
-63
lines changed
  • src
    • components/modebar
    • lib
      • < 10000 div class="PRIVATE_TreeView-item-level-line prc-TreeView-TreeViewItemLevelLine-KPSSL">
  • snapshot
  • 7 files changed

    +1
    -63
    lines changed

    src/components/modebar/buttons.js

    Lines changed: 0 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -51,11 +51,6 @@ modeBarButtons.toImage = {
    5151

    5252
    Lib.notifier(_(gd, 'Taking snapshot - this may take a few seconds'), 'long');
    5353

    54-
    if(opts.format !== 'svg' && Lib.isIE()) {
    55-
    Lib.notifier(_(gd, 'IE only supports svg. Changing format to svg.'), 'long');
    56-
    opts.format = 'svg';
    57-
    }
    58-
    5954
    ['filename', 'width', 'height', 'scale'].forEach(function(key) {
    6055
    if(key in toImageButtonOptions) {
    6156
    opts[key] = toImageButtonOptions[key];

    src/lib/index.js

    Lines changed: 0 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -755,10 +755,6 @@ lib.containsAny = function(s, fragments) {
    755755
    return false;
    756756
    };
    757757

    758-
    lib.isIE = function() {
    759-
    return typeof window.navigator.msSaveBlob !== 'undefined';
    760-
    };
    761-
    762758
    var IS_SAFARI_REGEX = /Ver 10000 sion\/[\d\.]+.*Safari/;
    763759
    lib.isSafari = function() {
    764760
    return IS_SAFARI_REGEX.test(window.navigator.userAgent);

    src/lib/supports_pixelated_image.js

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -19,7 +19,7 @@ function supportsPixelatedImage() {
    1919
    _supportsPixelated = false;
    2020

    2121
    // @see https://github.com/plotly/plotly.js/issues/6604
    22-
    var unsupportedBrowser = Lib.isIE() || Lib.isSafari() || Lib.isIOS();
    22+
    var unsupportedBrowser = Lib.isSafari() || Lib.isIOS();
    2323

    2424
    if(window.navigator.userAgent && !unsupportedBrowser) {
    2525
    var declarations = Array.from(constants.CSS_DECLARATIONS).reverse();

    src/snapshot/download.js

    Lines changed: 0 additions & 9 deletions
    Original file line numberDiff line numberDiff line change
    @@ -32,15 +32,6 @@ function downloadImage(gd, opts) {
    3232
    reject(new Error('Snapshotting already in progress.'));
    3333
    }
    3434

    35-
    // see comments within svgtoimg for additional
    36-
    // discussion of problems with IE
    37-
    // can now draw to canvas, but CORS tainted canvas
    38-
    // does not allow toDataURL
    39-
    // svg format will work though
    40-
    if(Lib.isIE() && opts.format !== 'svg') {
    41-
    reject(new Error(helpers.MSG_IE_BAD_FORMAT));
    42-
    }
    43-
    4435
    if(_gd) _gd._snapshotInProgress = true;
    4536
    var promise = toImage(gd, opts);
    4637

    src/snapshot/filesaver.js

    Lines changed: 0 additions & 10 deletions
    Original file line numberDiff line numberDiff line change
    @@ -23,16 +23,6 @@ function fileSaver(url, name, format) {
    2323
    var blob;
    2424
    var objectUrl;
    2525

    26-
    // IE 10+ (native saveAs)
    27-
    if(Lib.isIE()) {
    28-
    // At this point we are only dealing with a decoded SVG as
    29-
    // a data URL (since IE only supports SVG)
    30-
    blob = helpers.createBlob(url, 'svg');
    31-
    window.navigator.msSaveBlob(blob, name);
    32-
    blob = null;
    33-
    return resolve(name);
    34-
    }
    35-
    3626
    if(canUseSaveLink) {
    3727
    blob = helpers.createBlob(url, format);
    3828
    objectUrl = helpers.createObjectURL(blob);

    src/snapshot/svgtoimg.js

    Lines changed: 0 additions & 13 deletions
    Original file line numberDiff line numberDiff line change
    @@ -13,19 +13,6 @@ function svgToImg(opts) {
    1313
    var svg = opts.svg;
    1414
    var format = opts.format || 'png';
    1515

    16-
    // IE only support svg
    17-
    if(Lib.isIE() && format !== 'svg') {
    18-
    var ieSvgError = new Error(helpers.MSG_IE_BAD_FORMAT);
    19-
    reject(ieSvgError);
    20-
    // eventually remove the ev
    21-
    // in favor of promises
    22-
    if(!opts.promise) {
    23-
    return ev.emit('error', ieSvgError);
    24-
    } else {
    25-
    return promise;
    26-
    }
    27-
    }
    28-
    2916
    var canvas = opts.canvas;
    3017
    var scale = opts.scale || 1;
    3118
    var w0 = opts.width || 300;

    src/snapshot/tosvg.js

    Lines changed: 0 additions & 21 deletions
    Original file line numberDiff line numberDiff line change
    @@ -161,26 +161,5 @@ module.exports = function toSVG(gd, format, scale) {
    161161
    // Fix quotations around font strings and gradient URLs
    162162
    s = s.replace(DUMMY_REGEX, '\'');
    163163

    164-
    // Do we need this process now that IE9 and IE10 are not supported?
    165-
    166-
    // IE is very strict, so we will need to clean
    167-
    // svg with the following regex
    168-
    // yes this is messy, but do not know a better way
    169-
    // Even with this IE will not work due to tainted canvas
    170-
    // see https://github.com/kangax/fabric.js/issues/1957
    171-
    // http://stackoverflow.com/questions/18112047/canvas-todataurl-working-in-all-browsers-except-ie10
    172-
    // Leave here just in case the CORS/tainted IE issue gets resolved
    173-
    if(Lib.isIE()) {
    174-
    // replace double quote with single quote
    175-
    s = s.replace(/"/gi, '\'');
    176-
    // url in svg are single quoted
    177-
    // since we changed double to single
    178-
    // we'll need to change these to double-quoted
    179-
    s = s.replace(/(\('#)([^']*)('\))/gi, '(\"#$2\")');
    180-
    // font names with spaces will be escaped single-quoted
    181-
    // 4FCC we'll need to change these to double-quoted
    182-
    s = s.replace(/(\\')/gi, '\"');
    183-
    }
    184-
    185164
    return s;
    186165
    };

    0 commit comments

    Comments
     (0)
    0