mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
v1.5.51 - polyfill for replaceAll
This commit is contained in:
parent
a08c54cdf4
commit
65e84dd22a
1 changed files with 8 additions and 0 deletions
|
|
@ -510,6 +510,14 @@ function getComposedPath(node) {
|
|||
return [node];
|
||||
};
|
||||
|
||||
// polyfill for replaceAll
|
||||
if (!String.prototype.replaceAll) {
|
||||
String.prototype.replaceAll = function(str, newStr){
|
||||
if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') return this.replace(str, newStr);
|
||||
return this.replace(new RegExp(str, 'g'), newStr);
|
||||
};
|
||||
}
|
||||
|
||||
// get next unused id
|
||||
function getNextId(core, i = 1) {
|
||||
while (document.getElementById(core+i)) i++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue