oldie-polyfills.src.js 6.9 KB

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