Use [].slice.call when iterating over node lists
authorRaphaël Jakse <raphael.trivabble@jakse.fr>
Sun, 12 Apr 2020 18:14:15 +0000 (20:14 +0200)
committerRaphaël Jakse <raphael.trivabble@jakse.fr>
Sun, 12 Apr 2020 18:14:15 +0000 (20:14 +0200)
This is needed on Safari 9, used on the iPad 2.

trivabble.js

index 7e04edaf87af487c66a722d73fe37dc969b6a7c4..4281e37aae4bc0b78836fc0f848d5204535c331e 100644 (file)
             tileDest.appendChild(movingTile);
 
             if (isParentOf(board, tileDest)) {
-                for (const tile of board.getElementsByClassName("tile-highlight")) {
+                for (const tile of [].slice.call(board.getElementsByClassName("tile-highlight"))) {
                     tile.classList.remove("tile-highlight");
                 }
             }
@@ -1158,7 +1158,7 @@ let tile;
     }
 
     trivabble.applyL10n = function () {
-        for (const node of document.querySelectorAll("[data-l10n]")) {
+        for (const node of [].slice.call(document.querySelectorAll("[data-l10n]"))) {
             if (node.dataset.l10n === "text-content") {
                 node.textContent = _(node.textContent.trim());
             } else {