Blame view

src/main/webapp/libs/Highstock-7.2.0/code/modules/oldie-polyfills.src.js 5.91 KB
caiyongsong committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
/**
 * @license Highcharts JS v7.2.0 (2019-09-03)
 *
 * Old IE (v6, v7, v8) array polyfills for Highcharts v7+.
 *
 * (c) 2010-2019 Highsoft AS
 * Author: Torstein Honsi
 *
 * License: www.highcharts.com/license
 */
'use strict';
(function (factory) {
    if (typeof module === 'object' && module.exports) {
        factory['default'] = factory;
        module.exports = factory;
    } else if (typeof define === 'function' && define.amd) {
        define('highcharts/modules/oldie-polyfills', ['highcharts'], function (Highcharts) {
            factory(Highcharts);
            factory.Highcharts = Highcharts;
            return factory;
        });
    } else {
        factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
    }
}(function (Highcharts) {
    var _modules = Highcharts ? Highcharts._modules : {};
    function _registerModule(obj, path, args, fn) {
        if (!obj.hasOwnProperty(path)) {
            obj[path] = fn.apply(null, args);
        }
    }
    _registerModule(_modules, 'modules/oldie-polyfills.src.js', [], function () {
        /* *
         *
         *  (c) 2010-2019 Torstein Honsi
         *
         *  License: www.highcharts.com/license
         *
         *  !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
         *
         *  Simple polyfills for array functions in old IE browsers (6, 7 and 8) in
         *  Highcharts v7+. These polyfills are sufficient for Highcharts to work, but
         *  for fully compatible polyfills, see MDN.
         *
         * */
        /* global document */
        /* eslint-disable no-extend-native */
        if (!Array.prototype.forEach) {
            Array.prototype.forEach = function (fn, thisArg) {
                var i = 0, len = this.length;
                for (; i < len; i++) {
                    if (this[i] !== undefined && // added check
                        fn.call(thisArg, this[i], i, this) === false) {
                        return i;
                    }
                }
            };
        }
        if (!Array.prototype.map) {
            Array.prototype.map = function (fn
            // @todo support optional ctx
            ) {
                var results = [], i = 0, len = this.length;
                for (; i < len; i++) {
                    results[i] = fn.call(this[i], this[i], i, this);
                }
                return results;
            };
        }
        if (!Array.prototype.indexOf) {
            Array.prototype.indexOf = function (member, fromIndex) {
                var arr = this, // #8874
                len, i = fromIndex || 0; // #8346
                if (arr) {
                    len = arr.length;
                    for (; i < len; i++) {
                        if (arr[i] === member) {
                            return i;
                        }
                    }
                }
                return -1;
            };
        }
        if (!Array.prototype.filter) {
            Array.prototype.filter = function (fn
            // @todo support optional ctx
            ) {
                var ret = [], i = 0, length = this.length;
                for (; i < length; i++) {
                    if (fn(this[i], i)) {
                        ret.push(this[i]);
                    }
                }
                return ret;
            };
        }
        if (!Array.prototype.some) {
            Array.prototype.some = function (fn, thisArg) {
                var i = 0, len = this.length;
                for (; i < len; i++) {
                    if (fn.call(thisArg, this[i], i, this) === true) {
                        return true;
                    }
                }
                return false;
            };
        }
        if (!Array.prototype.reduce) {
            Array.prototype.reduce = function (func, initialValue) {
                var context = this, i = arguments.length > 1 ? 0 : 1, accumulator = arguments.length > 1 ? initialValue : this[0], len = this.length;
                for (; i < len; ++i) {
                    accumulator = func.call(context, accumulator, this[i], i, this);
                }
                return accumulator;
            };
        }
        if (!Object.keys) {
            Object.keys = function (obj) {
                var result = [], prop;
                for (prop in obj) {
                    if (Object.hasOwnProperty.call(obj, prop)) {
                        result.push(prop);
                    }
                }
                return result;
            };
        }
        // Add a getElementsByClassName function if the browser doesn't have one
        // Limitation: only works with one class name
        // Copyright: Eike Send http://eike.se/nd
        // License: MIT License
        if (!document.getElementsByClassName) {
            document.getElementsByClassName = function (search) {
                var d = document, elements, pattern, i, results = [];
                if (d.querySelectorAll) { // IE8
                    return d.querySelectorAll('.' + search);
                }
                if (d.evaluate) { // IE6, IE7
                    pattern = './/*[contains(concat(\' \', @class, \' \'), \' ' +
                        search + ' \')]';
                    elements = d.evaluate(pattern, d, null, 0, null);
                    while ((i = elements.iterateNext())) {
                        results.push(i);
                    }
                }
                else {
                    elements = d.getElementsByTagName('*');
                    pattern = new RegExp('(^|\\s)' + search + '(\\s|$)');
                    for (i = 0; i < elements.length; i++) {
                        if (pattern.test(elements[i].className)) {
                            results.push(elements[i]);
                        }
                    }
                }
                return results;
            };
        }

    });
    _registerModule(_modules, 'masters/modules/oldie-polyfills.src.js', [], function () {


    });
}));