Skip to content

Commit 907c491

Browse files
authored
Merge pull request #54 from github/Include-modal-selector-in-base-support
Include :modal selector in base support
2 parents 78aeb4e + 1480d9f commit 907c491

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ 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+
supportsModalPseudo = false
13+
}
14+
715
export const baseSupport =
816
typeof globalThis === 'object' &&
917
// ES2019
@@ -26,6 +34,7 @@ export const baseSupport =
2634
// DOM / HTML and other specs
2735
typeof queueMicrotask === 'function' &&
2836
typeof HTMLDialogElement === 'function' &&
37+
supportsModalPseudo &&
2938
typeof AggregateError === 'function' &&
3039
typeof BroadcastChannel === 'function' &&
3140
'randomUUID' in crypto &&

0 commit comments

Comments
 (0)