Skip to content

Could this be updated to return the native ResizeObserver if it exists? #127

Answered by TremayneChrist
bschlenk asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!

Performance of the native variant will be more performant, however, due to breaking changes of the spec, it's very difficult to return the correct matching native version. This is because it's not just the ResizeObserver API that has changed - it's also the ResizeObserverEntry. Adding this type of auto-detection would bloat the library, so I felt it best to leave it up the app logic.

It's worth noting that if you're only using the contentRect property of the entry, it's fine to do a simple check to see if the native variant is available and use it without any worry.

Hope this helps!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bschlenk
Comment options

Answer selected by bschlenk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants