#1358 Add findLastIndex polyfill for old Safari

9e522b033079e47c8c9c26256dc6fa1dbbf20562

Cohee <18619528+Cohee1207@users.noreply.github.com>

3 files changed, +14 -5Ignore whitespace
public/index.html+1 -1
@@ -6479,8 +6479,8 @@
64796479 </div>
64806480
64816481 <!-- Script includes -->
6482+ <script src="lib/polyfill.js"></script>
64826483 <script src="lib/diff_match_patch.js"></script>
6483- <script src="lib/object-hasown.js"></script>
64846484 <script src="lib/jquery-3.5.1.min.js"></script>
64856485 <script src="lib/jquery-ui.min.js"></script>
64866486 <script src="lib/jquery.transit.min.js"></script>
public/lib/object-hasown.js+0 -4
@@ -1,4 +0,0 @@
1-// Polyfill for old Safari versions
2-if (!Object.hasOwn) {
3- Object.hasOwn = function (obj, prop) { return obj.hasOwnProperty(prop); }
4-}
public/lib/polyfill.js+13 -0
@@ -0,0 +1,13 @@
1+// Polyfills for old Safari versions
2+if (!Object.hasOwn) {
3+ Object.hasOwn = function (obj, prop) { return obj.hasOwnProperty(prop); }
4+}
5+
6+if (!Array.prototype.findLastIndex) {
7+ Array.prototype.findLastIndex = function (callback, thisArg) {
8+ for (let i = this.length - 1; i >= 0; i--) {
9+ if (callback.call(thisArg, this[i], i, this)) return i;
10+ }
11+ return -1;
12+ };
13+}