mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FIX: prevents exception in the composer with regexp flags
This commit is contained in:
parent
629ae7a5b7
commit
5768011cad
1 changed files with 10 additions and 0 deletions
|
@ -179,4 +179,14 @@ if (!Array.prototype.find) {
|
|||
});
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/flags#Polyfill
|
||||
if (RegExp.prototype.flags === undefined) {
|
||||
Object.defineProperty(RegExp.prototype, "flags", {
|
||||
configurable: true,
|
||||
get: function() {
|
||||
return this.toString().match(/[gimsuy]*$/)[0];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue