Add polyfill for String.prototype.includes

pull/17125/head
Péter Szilágyi 8 years ago
parent b076014983
commit f112f782e6
No known key found for this signature in database
GPG Key ID: 119A76381CCB7DD2
  1. 2
      downloads/index.html
  2. 2
      guide/index.html
  3. 2
      index.html
  4. 2
      install/index.html
  5. 15
      static/scripts/custom/polyfills.js

@ -21,6 +21,8 @@
<script src="../static/scripts/marked.min.js"></script>
<script src="../static/scripts/emojify.min.js"></script>
<script src="../static/scripts/filesize.min.js"></script>
<script src="../static/scripts/custom/polyfills.js"></script>
</head>
<body>

@ -19,6 +19,8 @@
<script src="../static/scripts/moment.min.js"></script>
<script src="../static/scripts/marked.min.js"></script>
<script src="../static/scripts/emojify.min.js"></script>
<script src="../static/scripts/custom/polyfills.js"></script>
</head>
<body>

@ -20,6 +20,8 @@
<script src="./static/scripts/moment.min.js"></script>
<script src="./static/scripts/marked.min.js"></script>
<script src="./static/scripts/emojify.min.js"></script>
<script src="../static/scripts/custom/polyfills.js"></script>
</head>
<body>

@ -19,6 +19,8 @@
<script src="../static/scripts/moment.min.js"></script>
<script src="../static/scripts/marked.min.js"></script>
<script src="../static/scripts/emojify.min.js"></script>
<script src="../static/scripts/custom/polyfills.js"></script>
</head>
<body>

@ -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;
}
};
}
Loading…
Cancel
Save