Skip to content

Commit a948757

Browse files
authored
Include :modal selector in base support
1 parent 78aeb4e commit a948757

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import * as elementCheckVisibility from './element-checkvisibility.js'
44
import * as navigatorClipboard from './navigator-clipboard.js'
55
import * as requestIdleCallback from './requestidlecallback.js'
66

7+
let supportsModalPseudo = false
8+
try {
9+
// This will error in older browsers
10+
supportsModalPseudo = document.body.matches(':modal') === false
11+
} catch {}
12+
713
export const baseSupport =
814
typeof globalThis === 'object' &&
915
// ES2019
@@ -26,6 +32,7 @@ export const baseSupport =
2632
// DOM / HTML and other specs
2733
typeof queueMicrotask === 'function' &&
2834
typeof HTMLDialogElement === 'function' &&
35+
supportsModalPseudo &&
2936
typeof AggregateError === 'function' &&
3037
typeof BroadcastChannel === 'function' &&
3138
'randomUUID' in crypto &&

0 commit comments

Comments
 (0)