From f112f782e6b805bdf661910931643fa63e473ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Wed, 23 Nov 2016 14:14:38 +0200 Subject: [PATCH] Add polyfill for String.prototype.includes --- downloads/index.html | 2 ++ guide/index.html | 2 ++ index.html | 2 ++ install/index.html | 2 ++ static/scripts/custom/polyfills.js | 15 +++++++++++++++ 5 files changed, 23 insertions(+) create mode 100644 static/scripts/custom/polyfills.js diff --git a/downloads/index.html b/downloads/index.html index 7b90a5f456..e704c6c109 100644 --- a/downloads/index.html +++ b/downloads/index.html @@ -21,6 +21,8 @@ + + diff --git a/guide/index.html b/guide/index.html index 931fd54370..445c8e5c91 100644 --- a/guide/index.html +++ b/guide/index.html @@ -19,6 +19,8 @@ + + diff --git a/index.html b/index.html index d33ad19252..fbcd6e2a51 100644 --- a/index.html +++ b/index.html @@ -20,6 +20,8 @@ + + diff --git a/install/index.html b/install/index.html index 8c958e8100..ff1379b31f 100644 --- a/install/index.html +++ b/install/index.html @@ -19,6 +19,8 @@ + + diff --git a/static/scripts/custom/polyfills.js b/static/scripts/custom/polyfills.js new file mode 100644 index 0000000000..735d6cbc09 --- /dev/null +++ b/static/scripts/custom/polyfills.js @@ -0,0 +1,15 @@ +// Polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes +if (!String.prototype.includes) { + String.prototype.includes = function(search, start) { + 'use strict'; + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > this.length) { + return false; + } else { + return this.indexOf(search, start) !== -1; + } + }; +}