diff options
author | Chris Buechler <cmb@pfsense.org> | 2016-06-30 20:10:07 -0500 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-06-30 20:10:07 -0500 |
commit | 591b9184cba38d6d960cd83861fdb922c17dc2cb (patch) | |
tree | 8d97310e99e35b903381e17b792b70f8f078a523 | |
parent | d2f324642f7a8d458987fe29aade9eb387de3cbb (diff) | |
parent | b07f8f3fe4daadb5093d9cac2fbb5984ea24fe2e (diff) | |
download | pfsense-591b9184cba38d6d960cd83861fdb922c17dc2cb.zip pfsense-591b9184cba38d6d960cd83861fdb922c17dc2cb.tar.gz |
Merge pull request #3034 from NOYB/startsWith_Polyfill
-rw-r--r-- | src/usr/local/www/js/polyfills.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/usr/local/www/js/polyfills.js b/src/usr/local/www/js/polyfills.js index 268ca1f..fb00564 100644 --- a/src/usr/local/www/js/polyfills.js +++ b/src/usr/local/www/js/polyfills.js @@ -20,3 +20,18 @@ if (!String.prototype.includes) { } }; } + +/*** +** +** Polyfill for older browsers that don't yet have the newer string "startsWith()" method implemented. +** Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith#Polyfill +** Documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith +** +***/ + +if (!String.prototype.startsWith) { + String.prototype.startsWith = function(searchString, position){ + position = position || 0; + return this.substr(position, searchString.length) === searchString; + }; +} |