-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbsindex.js
More file actions
66 lines (66 loc) · 2.15 KB
/
bsindex.js
File metadata and controls
66 lines (66 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import * as clipboardItem from './clipboarditem.js';
import * as elementCheckVisibility from './element-checkvisibility.js';
import * as navigatorClipboard from './navigator-clipboard.js';
import * as withResolvers from './promise-withResolvers.js';
import * as requestIdleCallback from './requestidlecallback.js';
import * as popover from '@oddbird/popover-polyfill/fn';
import * as commandAndCommandFor from 'invokers-polyfill/fn';
let supportsModalPseudo = false;
try {
// This will error in older browsers
supportsModalPseudo = document.body.matches(':modal') === false;
}
catch {
supportsModalPseudo = false;
}
export const baseSupport = typeof globalThis === 'object' &&
// ES2019
'fromEntries' in Object &&
'flatMap' in Array.prototype &&
'trimEnd' in String.prototype &&
// ES2020
'allSettled' in Promise &&
'matchAll' in String.prototype &&
// ES2021
'replaceAll' in String.prototype &&
'any' in Promise &&
// ES2022
'at' in String.prototype &&
'at' in Array.prototype &&
'hasOwn' in Object &&
// ESNext
'abort' in AbortSignal &&
'timeout' in AbortSignal &&
// DOM / HTML and other specs
typeof queueMicrotask === 'function' &&
typeof HTMLDialogElement === 'function' &&
supportsModalPseudo &&
typeof AggregateError === 'function' &&
typeof BroadcastChannel === 'function' &&
'randomUUID' in crypto &&
'replaceChildren' in Element.prototype &&
'requestSubmit' in HTMLFormElement.prototype &&
// 'requestIdleCallback' in window && // Polyfilled
true;
export const polyfills = {
clipboardItem,
elementCheckVisibility,
navigatorClipboard,
requestIdleCallback,
withResolvers,
popover,
commandAndCommandFor,
};
export function isSupported() {
return baseSupport && Object.values(polyfills).every(polyfill => polyfill.isSupported());
}
export function isPolyfilled() {
return Object.values(polyfills).every(polyfill => polyfill.isPolyfilled());
}
export function apply() {
for (const polyfill of Object.values(polyfills)) {
if (!polyfill.isSupported())
polyfill.apply();
}
}
//# sourceMappingURL=index.js.map