Skip to content

A platform for community discussion. Free, open, simple.

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

Joffrey JAFFEUX2fa380892836
diff --git a/app/assets/javascripts/polyfills.js b/app/assets/javascripts/polyfills.js
index 49cc9bef303..9d2b88d162d 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 */