Skip to content

Commit ca3819b

Browse files
committed
More fixes for IE11
1 parent ae40d3c commit ca3819b

File tree

4 files changed

+1159
-412
lines changed

4 files changed

+1159
-412
lines changed

src/xregexp.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,19 @@ function hasNativeFlag(flag) {
6767
// Can't use regex literals for testing even in a `try` because regex literals with
6868
// unsupported flags cause a compilation error in IE
6969
new RegExp('', flag);
70+
71+
// Work around a broken/incomplete IE11 polyfill for sticky introduced in core-js 3.6.0
72+
if (flag === 'y') {
73+
// Using function to avoid babel transform to regex literal
74+
const gy = (() => 'gy')();
75+
const incompleteY = '.a'.replace(new RegExp('a', gy), '.') === '..';
76+
if (incompleteY) {
77+
isSupported = false;
78+
}
79+
}
7080
} catch (exception) {
7181
isSupported = false;
7282
}
73-
// Work around a broken/incomplete IE11 polyfill for sticky introduced in core-js 3.6.0
74-
if (flag === 'y') {
75-
const incompleteY = '.a'.replace(new RegExp('a', 'gy'), '.') === '..';
76-
if (incompleteY) {
77-
isSupported = false;
78-
}
79-
}
8083
return isSupported;
8184
}
8285
// Check for ES6 `u` flag support

tests/helpers/h.js

+7
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@ global.hasStrictMode = (function() {
2222

2323
return !this;
2424
}());
25+
26+
// Naive polyfill of String.prototype.repeat
27+
if (!String.prototype.repeat) {
28+
String.prototype.repeat = function(count) {
29+
return count ? Array(count + 1).join(this) : '';
30+
};
31+
}

tests/perf/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
var match = /[?&]version=([^&]+)/.exec(location.search);
2525
var version = match ? match[1] : null;
2626
var knownVersion = {
27-
'4.3.0': true,
27+
'4.3.1': true,
2828
'4.2.4': true,
2929
'4.2.3': true,
3030
'4.2.0': true,

0 commit comments

Comments
 (0)