mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:23:00 +08:00
FIX: Polyfill String.startsWith function for IE11
Followup to fe0d912b97985a6272e720729aa6197e8e40274f
This commit is contained in:
@ -321,6 +321,16 @@ if (!String.prototype.repeat) {
|
||||
};
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith#Polyfill
|
||||
if (!String.prototype.startsWith) {
|
||||
Object.defineProperty(String.prototype, "startsWith", {
|
||||
value: function(search, rawPos) {
|
||||
var pos = rawPos > 0 ? rawPos | 0 : 0;
|
||||
return this.substring(pos, pos + search.length) === search;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
* Symbol-ES6 v0.1.2
|
||||
* ES6 Symbol polyfill in pure ES5.
|
||||
|
Reference in New Issue
Block a user