Skip to content

Commit

Permalink
fix: check if ResizeObserver is available in observeElementRect (#645)
Browse files Browse the repository at this point in the history
Co-authored-by: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com>
  • Loading branch information
pan-kot and lachlancollins authored Feb 18, 2024
1 parent 0cedda3 commit 3a1c256
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/virtual-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export const observeElementRect = <T extends Element>(

handler(element.getBoundingClientRect())

if (typeof ResizeObserver === 'undefined') {
return () => {}
}

const observer = new ResizeObserver((entries) => {
const entry = entries[0]
if (entry?.borderBoxSize) {
Expand Down

0 comments on commit 3a1c256

Please sign in to comment.