Skip to content

Commit 2332cec

Browse files
authored
Merge pull request #16408 from vector-im/jryans/regexp-dotall
Add RegExp dotAll feature test
2 parents e562c54 + 27a92a5 commit 2332cec

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/vector/index.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,20 @@ function checkBrowserFeatures() {
4545
return false;
4646
}
4747

48-
// custom checks atop Modernizr because it doesn't have ES2018/ES2019 checks in it for some features we depend on,
49-
// Modernizr requires rules to be lowercase with no punctuation:
50-
// ES2018: http://www.ecma-international.org/ecma-262/9.0/#sec-promise.prototype.finally
48+
// Custom checks atop Modernizr because it doesn't have ES2018/ES2019 checks
49+
// in it for some features we depend on.
50+
// Modernizr requires rules to be lowercase with no punctuation.
51+
// ES2018: http://262.ecma-international.org/9.0/#sec-promise.prototype.finally
5152
window.Modernizr.addTest("promiseprototypefinally", () =>
52-
window.Promise && window.Promise.prototype && typeof window.Promise.prototype.finally === "function");
53-
// ES2019: http://www.ecma-international.org/ecma-262/10.0/#sec-object.fromentries
53+
typeof window.Promise?.prototype?.finally === "function");
54+
// ES2018: https://262.ecma-international.org/9.0/#sec-get-regexp.prototype.dotAll
55+
window.Modernizr.addTest("regexpdotall", () => (
56+
window.RegExp?.prototype &&
57+
!!Object.getOwnPropertyDescriptor(window.RegExp.prototype, "dotAll")?.get
58+
));
59+
// ES2019: http://262.ecma-international.org/10.0/#sec-object.fromentries
5460
window.Modernizr.addTest("objectfromentries", () =>
55-
window.Object && typeof window.Object.fromEntries === "function");
61+
typeof window.Object?.fromEntries === "function");
5662

5763
const featureList = Object.keys(window.Modernizr);
5864

0 commit comments

Comments
 (0)