Skip to content

Commit

Permalink
Merge pull request #57 from QuickCorp/v2.3
Browse files Browse the repository at this point in the history
tc39 mathAll polifyll for old browsers that do not support String.prototype.matchAll
  • Loading branch information
jeanmachuca committed Apr 22, 2021
2 parents 5f4fc4a + 270561a commit dfc4fe4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions QCObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,22 @@
return _m;
};

String.prototype.__mAll__ = function (regex) {
// This is an alternative to old browsers that dont support String.prototype.matchAll
// https://github.com/tc39/proposal-string-matchall
var matches = [];
this.replace(regex, function () {
var match = Array.prototype.slice.call(arguments, 0, -2);
match.input = arguments[arguments.length - 1];
match.index = arguments[arguments.length - 2];
matches.push(match);
});
return matches;
}
if (typeof String.prototype.matchAll === "undefined"){
String.prototype.matchAll = String.prototype.__mAll__;
}

var isBrowser = typeof window !== "undefined" && typeof window.self !== "undefined" && window === window.self;
var _DOMCreateElement = function(elementName) {
var _ret_;
Expand Down

0 comments on commit dfc4fe4

Please sign in to comment.