|
34 | 34 | </noscript>
|
35 | 35 | <script>
|
36 | 36 | // polyfills
|
37 |
| - |
38 |
| - Number.parseInt = Number.parseInt || parseInt; // IE 11 |
39 |
| - Number.parseFloat = Number.parseFloat || parseFloat; // IE 11 |
40 |
| - Number.isInteger = Number.isInteger || function (value) { // IE 11 |
41 |
| - return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; |
42 |
| - }; |
43 |
| - |
44 |
| - // Required for material-ui/Select IE 11 |
45 |
| - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes |
46 |
| - // https://tc39.github.io/ecma262/#sec-array.prototype.includes |
47 |
| - if (!Array.prototype.includes) { |
48 |
| - Object.defineProperty(Array.prototype, 'includes', { // eslint-disable-line prefer-reflect,no-extend-native |
49 |
| - value: function (searchElement, fromIndex) { |
50 |
| - // 1. Let O be ? ToObject(this value). |
51 |
| - if (this == null) { |
52 |
| - throw new TypeError('"this" is null or not defined'); |
53 |
| - } |
54 |
| - |
55 |
| - var o = Object(this); |
56 |
| - |
57 |
| - // 2. Let len be ? ToLength(? Get(O, "length")). |
58 |
| - var len = o.length >>> 0; |
59 |
| - |
60 |
| - // 3. If len is 0, return false. |
61 |
| - if (len === 0) { |
62 |
| - return false; |
63 |
| - } |
64 |
| - |
65 |
| - // 4. Let n be ? ToInteger(fromIndex). |
66 |
| - // (If fromIndex is undefined, this step produces the value 0.) |
67 |
| - var n = fromIndex | 0; |
68 |
| - |
69 |
| - // 5. If n ≥ 0, then |
70 |
| - // a. Let k be n. |
71 |
| - // 6. Else n < 0, |
72 |
| - // a. Let k be len + n. |
73 |
| - // b. If k < 0, let k be 0. |
74 |
| - var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); |
75 |
| - |
76 |
| - function sameValueZero (x, y) { |
77 |
| - return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y)); |
78 |
| - } |
79 |
| - |
80 |
| - // 7. Repeat, while k < len |
81 |
| - while (k < len) { |
82 |
| - // a. Let elementK be the result of ? Get(O, ! ToString(k)). |
83 |
| - // b. If SameValueZero(searchElement, elementK) is true, return true. |
84 |
| - // c. Increase k by 1. |
85 |
| - if (sameValueZero(o[k], searchElement)) { |
86 |
| - return true; |
87 |
| - } |
88 |
| - k += 1; |
89 |
| - } |
90 |
| - |
91 |
| - // 8. Return false |
92 |
| - return false; |
93 |
| - } |
94 |
| - }); |
95 |
| - } |
96 |
| - |
97 |
| - |
98 | 37 | var features = [
|
| 38 | + 'Array.prototype.includes', // IE 11 - material-ui/Select |
| 39 | + 'Number.parseInt', // IE 11 |
| 40 | + 'Number.parseFloat', // IE 11 |
99 | 41 | 'Map', // IE 10
|
100 | 42 | 'Set', // IE 10
|
101 | 43 | 'requestAnimationFrame', // IE 9
|
102 |
| - 'Intl.~locale.en-CA', // IE 10, Safari 9 |
| 44 | + 'Intl.~locale.en-CA' // IE 10, Safari 9 |
103 | 45 | ];
|
104 | 46 |
|
105 | 47 | function missingFeatures() {
|
106 |
| - return features.filter(function(f) { return !window[f.split('.')[0]] }); |
| 48 | + return features.filter(function (f) { |
| 49 | + var a = f.split('.'); |
| 50 | + var c = a[a.length - 1]; |
| 51 | + |
| 52 | + switch(a[0]) { |
| 53 | + case 'Number': return (typeof Number[c] !== 'function'); |
| 54 | + case 'Array': return (typeof Array.prototype[c] !== 'function'); |
| 55 | + } |
| 56 | + |
| 57 | + return !window[a[0]]; |
| 58 | + }); |
107 | 59 | }
|
| 60 | + |
108 | 61 | var missing = missingFeatures();
|
109 | 62 |
|
110 | 63 | if (missing.length) {
|
|
0 commit comments