mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add polyfills for IE11
This commit is contained in:
parent
4f31632863
commit
efad7270b7
@ -125,6 +125,7 @@ module.exports = function(grunt) {
|
|||||||
src: [
|
src: [
|
||||||
// Ensure editor source files are concatenated in
|
// Ensure editor source files are concatenated in
|
||||||
// the right order
|
// the right order
|
||||||
|
"packages/node_modules/@node-red/editor-client/src/js/polyfills.js",
|
||||||
"packages/node_modules/@node-red/editor-client/src/js/jquery-addons.js",
|
"packages/node_modules/@node-red/editor-client/src/js/jquery-addons.js",
|
||||||
"packages/node_modules/@node-red/editor-client/src/js/red.js",
|
"packages/node_modules/@node-red/editor-client/src/js/red.js",
|
||||||
"packages/node_modules/@node-red/editor-client/src/js/events.js",
|
"packages/node_modules/@node-red/editor-client/src/js/events.js",
|
||||||
|
34
packages/node_modules/@node-red/editor-client/src/js/polyfills.js
vendored
Normal file
34
packages/node_modules/@node-red/editor-client/src/js/polyfills.js
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
(function() {
|
||||||
|
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
|
||||||
|
|
||||||
|
if (isIE11) {
|
||||||
|
// IE11 does not provide classList on SVGElements
|
||||||
|
if (! ("classList" in SVGElement.prototype)) {
|
||||||
|
Object.defineProperty(SVGElement.prototype, 'classList', Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'classList'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// IE11 does not provide children on SVGElements
|
||||||
|
if (! ("children" in SVGElement.prototype)) {
|
||||||
|
Object.defineProperty(SVGElement.prototype, 'children', Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'children'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Array.from) {
|
||||||
|
// JSONata provides an Array.from polyfill that doesn't handle iterables.
|
||||||
|
// So in IE11 we expect Array.from to exist already, it just needs some
|
||||||
|
// changes to support iterables.
|
||||||
|
throw new Error("Missing Array.from base polyfill");
|
||||||
|
}
|
||||||
|
Array._from = Array.from;
|
||||||
|
Array.from = function() {
|
||||||
|
var arrayLike = arguments[0]
|
||||||
|
if (arrayLike.forEach) {
|
||||||
|
var result = [];
|
||||||
|
arrayLike.forEach(function(i) {
|
||||||
|
result.push(i);
|
||||||
|
})
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return Array._from.apply(null,arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
Loading…
Reference in New Issue
Block a user