Skip to content

Commit

Permalink
Merge pull request #201 from oddbird/ssr
Browse files Browse the repository at this point in the history
Do not error if `window` is undefined
  • Loading branch information
jgerigmeyer authored Apr 26, 2024
2 parents dd39efa + e839234 commit 2423d24
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ export function injectStyles(root: Document | ShadowRoot) {
}

export function apply() {
globalThis.ToggleEvent = globalThis.ToggleEvent || ToggleEvent;
if (typeof window === 'undefined') return;

window.ToggleEvent = window.ToggleEvent || ToggleEvent;

function rewriteSelector(selector: string) {
if (selector?.includes(':popover-open')) {
Expand Down

0 comments on commit 2423d24

Please sign in to comment.