FIX: polyfills forEach support on NodeList for IE11 (#8213)

FIX: polyfills forEach support on NodeList for IE11 (#8213)

diff --git a/app/assets/javascripts/polyfills.js b/app/assets/javascripts/polyfills.js
index 49cc9bef30..9d2b88d162 100644
--- a/app/assets/javascripts/polyfills.js
+++ b/app/assets/javascripts/polyfills.js
@@ -356,4 +356,14 @@ if (!String.prototype.repeat) {
   };
 }
 
+// https://developer.mozilla.org/fr/docs/Web/API/NodeList/forEach
+if (window.NodeList && !NodeList.prototype.forEach) {
+  NodeList.prototype.forEach = function(callback, thisArg) {
+    thisArg = thisArg || window;
+    for (var i = 0; i < this.length; i++) {
+      callback.call(thisArg, this[i], i, this);
+    }
+  };
+}
+
 /* eslint-enable */

GitHub sha: 2fa38089

1 Like