Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Ponyfills
  3. resize-observer-polyfill

resize-observer-polyfill

MITJavaScript1.5.1

A polyfill for the Resize Observer API that uses MutationObserver and Mutation Events without polling.

GitHubGitHub
1.7k stars130 forks0 contributors

What is resize-observer-polyfill?

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.

Target Audience

Frontend developers building responsive web applications that need to react to element size changes across multiple browsers, including older versions of Internet Explorer (IE9+).

Value Proposition

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.

Overview

A polyfill for the Resize Observer API

Use Cases

Best For

  • Adding responsive behavior to elements that change size dynamically
  • Building cross-browser compatible applications that require element resize detection
  • Observing size changes during CSS transitions and animations
  • Supporting older browsers like IE9 and IE10 with modern resize observation
  • Implementing custom layouts that react to container or content dimension changes
  • Creating reusable components that need to adapt to their parent container's size

Not Ideal For

  • Applications requiring real-time, sub-20ms resize notifications for interactive elements like live dashboards or gaming interfaces
  • Projects exclusively targeting modern browsers with native ResizeObserver support (e.g., Chrome 64+, Firefox 69+), where the polyfill adds unnecessary overhead
  • Use cases where observing size changes from CSS pseudo-classes like :hover is critical without implementing additional transition-based workarounds
  • Environments with strict performance budgets that cannot tolerate any polyfill overhead, even from a lightweight 2.44 KiB bundle

Pros & Cons

Pros

Spec-Compliant Accuracy

Follows the official Resize Observer specification closely, mimicking native browser behavior for consistent cross-browser implementation, as emphasized in the README's philosophy.

Lightweight Performance

Minified and gzipped size is only 2.44 KiB, minimizing load time and performance impact compared to polling-based alternatives.

No Polling Overhead

Relies on MutationObserver and Mutation Events to detect DOM changes, avoiding continuous layout checks that can degrade application performance.

Handles CSS Animations

Can observe size changes caused by CSS transitions and animations, making it suitable for dynamic interfaces, as stated in the key features.

Cons

Notification Delay

Admits notifications are delivered ~20ms after actual changes, which may cause jank in time-sensitive applications like real-time visualizations.

Limited Pseudo-Class Support

Cannot track changes from dynamic CSS pseudo-classes like :hover without manual workarounds, a acknowledged limitation that restricts use in highly interactive UIs.

Deprecated Global Version

The global version (dist/ResizeObserver.global) is deprecated and will be removed, forcing legacy setups to migrate and potentially breaking existing implementations.

Frequently Asked Questions

Quick Stats

Stars1,746
Forks130
Contributors0
Open Issues33
Last commit3 years ago
CreatedSince 2016

Tags

#ponyfill#polyfill#browser-api#dom#frontend#javascript#web-development#responsive-design

Built With

U
UMD
J
JavaScript
E
ES5
E
ES6

Included in

Ponyfills63
Auto-fetched 1 day ago

Related Projects

cross-fetchcross-fetch

Universal WHATWG Fetch API for Node, Browsers and React Native.

Stars1,694
Forks106
Last commit1 year ago
css-vars-ponyfillcss-vars-ponyfill

Client-side support for CSS custom properties (aka "CSS variables") in legacy and modern browsers

Stars1,454
Forks63
Last commit2 years ago
rafraf

requestAnimationFrame polyfill library

Stars736
Forks53
Last commit4 years ago
abortcontroller-polyfillabortcontroller-polyfill

Polyfill for the AbortController DOM API and abortable fetch (stub that calls catch, doesn't actually abort request).

Stars340
Forks30
Last commit1 year ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub