Add Modernizr rule for Intl.Segmenter

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2024-07-05 11:26:22 +01:00
parent a7ace95eac
commit 4d0c740ad2
No known key found for this signature in database
GPG key ID: A2B008A5F49F5D0D

View file

@ -56,8 +56,7 @@ function checkBrowserFeatures(): boolean {
return false; return false;
} }
// Custom checks atop Modernizr because it doesn't have ES2018/ES2019 checks // Custom checks atop Modernizr because it doesn't have modern checks in it for some features we depend on.
// in it for some features we depend on.
// Modernizr requires rules to be lowercase with no punctuation. // Modernizr requires rules to be lowercase with no punctuation.
// ES2018: http://262.ecma-international.org/9.0/#sec-promise.prototype.finally // ES2018: http://262.ecma-international.org/9.0/#sec-promise.prototype.finally
window.Modernizr.addTest("promiseprototypefinally", () => typeof window.Promise?.prototype?.finally === "function"); window.Modernizr.addTest("promiseprototypefinally", () => typeof window.Promise?.prototype?.finally === "function");
@ -70,6 +69,8 @@ function checkBrowserFeatures(): boolean {
); );
// ES2019: http://262.ecma-international.org/10.0/#sec-object.fromentries // ES2019: http://262.ecma-international.org/10.0/#sec-object.fromentries
window.Modernizr.addTest("objectfromentries", () => typeof window.Object?.fromEntries === "function"); window.Modernizr.addTest("objectfromentries", () => typeof window.Object?.fromEntries === "function");
// ES2024: https://402.ecma-international.org/9.0/#sec-intl.segmenter
window.Modernizr.addTest("intlsegmenter", () => typeof window.Intl?.Segmenter === "function");
const featureList = Object.keys(window.Modernizr) as Array<keyof ModernizrStatic>; const featureList = Object.keys(window.Modernizr) as Array<keyof ModernizrStatic>;