From 2fa380892836a0f650905ae70235358e82ac26de Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Fri, 18 Oct 2019 12:27:51 +0200 Subject: [PATCH] FIX: polyfills forEach support on NodeList for IE11 (#8213) --- app/assets/javascripts/polyfills.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 */