luci-base: luci.js: add Object.assign polyfill
authorJo-Philipp Wich <jo@mein.io>
Sun, 6 Jan 2019 15:37:05 +0000 (16:37 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sun, 7 Jul 2019 13:25:49 +0000 (15:25 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/luci.js

index 4cb8bf4e5d08cb0cb293ade5a5afd719dde6611a..a481f886c1950e0842bb4173194f924069bc2610 100644 (file)
@@ -1,4 +1,26 @@
 (function(window, document, undefined) {
+       /* Object.assign polyfill for IE */
+       if (typeof Object.assign !== 'function') {
+               Object.defineProperty(Object, 'assign', {
+                       value: function assign(target, varArgs) {
+                               if (target == null)
+                                       throw new TypeError('Cannot convert undefined or null to object');
+
+                               var to = Object(target);
+
+                               for (var index = 1; index < arguments.length; index++)
+                                       if (arguments[index] != null)
+                                               for (var nextKey in arguments[index])
+                                                       if (Object.prototype.hasOwnProperty.call(arguments[index], nextKey))
+                                                               to[nextKey] = arguments[index][nextKey];
+
+                               return to;
+                       },
+                       writable: true,
+                       configurable: true
+               });
+       }
+
        var modalDiv = null,
            tooltipDiv = null,
            tooltipTimeout = null,