A polyfill for the Resize Observer API that uses MutationObserver and Mutation Events without polling.
ResizeObserver Polyfill is a JavaScript library that implements the Resize Observer API for browsers that don't support it natively. It allows developers to detect when an element's size changes, such as due to layout shifts, CSS animations, or dynamic content, without using inefficient polling techniques. The polyfill follows the official specification and provides a near-native experience.
Frontend developers building responsive web applications that need to react to element size changes across multiple browsers, including older versions of Internet Explorer (IE9+).
Developers choose this polyfill because it's lightweight, spec-compliant, and uses efficient DOM mutation observers instead of polling. It handles edge cases like CSS transitions and doesn't require modifying observed elements, making it a reliable drop-in solution for cross-browser ResizeObserver support.
A polyfill for the Resize Observer API
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Follows the official Resize Observer specification closely, mimicking native browser behavior for consistent cross-browser implementation, as emphasized in the README's philosophy.
Minified and gzipped size is only 2.44 KiB, minimizing load time and performance impact compared to polling-based alternatives.
Relies on MutationObserver and Mutation Events to detect DOM changes, avoiding continuous layout checks that can degrade application performance.
Can observe size changes caused by CSS transitions and animations, making it suitable for dynamic interfaces, as stated in the key features.
Admits notifications are delivered ~20ms after actual changes, which may cause jank in time-sensitive applications like real-time visualizations.
Cannot track changes from dynamic CSS pseudo-classes like :hover without manual workarounds, a acknowledged limitation that restricts use in highly interactive UIs.
The global version (dist/ResizeObserver.global) is deprecated and will be removed, forcing legacy setups to migrate and potentially breaking existing implementations.